Thanks for the suggestions, nobre84.
I was hoping for the 2nd option so that I wouldn't have to subclass the navigation controller as it is implicitly defined for table views (and automatically takes care of changing the label for the back button to reflect the name of the previous table).
But viewWillDisappear doesn't actually get invoked when a user simply presses the back button on the top of a table view since the table view itself doesn't actually disappear - only its data gets updated.
So I guess I will need to customize things...dang!
Quote:
Originally Posted by nobre84
You have 3 options:
- Use a custom back button and use its action to do what you need (you'll need to use your own graphics if you want the arrow shape of the standard back button)
- Use viewWillDisappear and keep state when you are disappearing forward (didSelect) and backwards (back button)
- If you must really intercept the standard back button and sometimes denying the ability to go back, you must subclass UINavigationController and override navigationBar:shouldPopItem: . I do this to query my controllers if the user is allowed to go back at some places (i.e when they have unsaved changes on the detail view I ask for permission at first before letting they go back)
|