Harish Saran Harish Saran - 1 year ago 147
iOS Question

UINavigationController and back button action

I have an two

1st is
and 2nd is
, where I'm pushing
in stack, so the back button is automatically coming.

Here I need to make an alert when the user presses the back button.

How can I do this?

Answer Source

Or you can use the UINavigationController's delegate methods. The method willShowViewController is called when the back button of your VC is pressed.

- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download