Is it possible to check when the back button is pressed in a UINavigationController stack? I've tried adding a action and target to self.navigationItem.backBarButtonItem to no avail.
Anyone have any solutions?
Is it possible to check when the back button is pressed in a UINavigationController stack? I've tried adding a action and target to self.navigationItem.backBarButtonItem to no avail.
Anyone have any solutions?
You can try my way:
Write in your ViewController:
And action method:
You have to take a photo of back button you want.
Animation of hiding back button when viewController is popped is not the same animation of iOS!
P/s: I've get it from simulator. Hope it useful! :)
One way to get at this would be to override
viewWillDisappear
in the UIViewController that is visible when the back button is pressed:Obviously this doesn't directly intercept the press on the back button itself, but it gives you a chance to perform logic at that time.