I want to be able to check for specific conditions when a user selects the "back" button from a naviga开发者_Python百科tion controller - then display an alert and stop the pop up the navigation stack from occurring.
I can get notified in the viewWillDissappear method that the pop is about to occur - but is there a mechanism to stop the pop from happening?
You can try subclassing UINavigationController and then override the popViewController method to include your logic.
- (UIViewController *)popViewControllerAnimated:(BOOL)animated
[edit to include an example] http://www.hanspinckaers.com/custom-action-on-back-button-uinavigationcontroller
Cheers, Rog
精彩评论