Don Wilson
Don Wilson

Reputation: 2303

Controlling changes in the navigation stack

I want to be able to check for specific conditions when a user selects the "back" button from a navigation 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?

Upvotes: 0

Views: 84

Answers (1)

Rog
Rog

Reputation: 18670

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

Upvotes: 1

Related Questions