Search code examples
iphoneobjective-cipaduinavigationcontroller

UINavigationController - two left buttons plus back button


In my view I need to have two left buttons on my nav bar. A custom button and also the standard back button (created by the nav controller) on the left.

However I need to have the back button the normal standard back button arrow and have a method which is called when tapping it.


Solution

  • I remember reading somewhere in the Human Interface Guidelines that Apple specifically discourages this. Unless you are willing to risk app rejection and possibly confusing your users, I'd recommend you dig into the HIG and find out if you can do this or not.

    If you need to have it, you will have to make your own custom implementation, as the nav bar doesn't support what your asking. You will need to hide the back button, then place your own custom back buttons on the bar, likely created from a sub-class of UIView.

    If you don't need them both to be back buttons, then you might get away with getting the frame of the back button, and placing another button of your own to the right of it.