Abhinav
Abhinav

Reputation: 38162

Navigation application -- Back Button

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

Answers (2)

westsider
westsider

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

Daddy
Daddy

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

Related Questions