Due to a weird request which I tried to turn down but it didn\'t work, I had to override the navigationBar\'s back Button.
I have made a custom UINavigationControlle
I would suggest a completely different approach.
Create a base class for the view controllers that you are pushing on the navigation stack. In the viewDidLoad
method set your custom button as the leftBarButtonItem
of the navigationItem
and add a -backAction:
which invokes the popViewControllerAnimated:
method of the navigation controller.
That way you won't care about things like losing functionality of UINavigationController
like the swipe to pop and you won't have to override the navigationBar:shouldPopItem:
method at all.