Reputation: 38162
When we click on the back button on a nav view, is there any method (delegate) which gets called on current view controller before poping it out of stack and pushing next in stack?
Upvotes: 3
Views: 365
Reputation: 4985
You can hook up your own -back:(id)sender method as the selector for your back button and then do what ever you want inside that method, as long as you call:
[[self navigationController] popViewControllerAnimated:YES];
Upvotes: 2
Reputation: 9035
The only method available is the viewWillDisappear and the viewDidDisappear in the viewController managed by the UINavigationController. You might be able to check the size of the UINavigationController viewController array property and compare it with the last known -count. If there are more controllers in the stack, you know that something was pushed. If there are less, something was popped.
Upvotes: 3