I have a project that uses UIViewControllers embedded in navigation view controllers, so the back button is automatically set up for me whenever I segue into any detail of m
These two lines with do the trick. Set leftItemSupplementBackButton
to true, and then add leftBarButtonsItems
.
self.navigationItem.leftItemsSupplementBackButton = true
self.navigationItem.leftBarButtonItems = [barButton]
By default, the leftItemsSupplementBackButton
property is false
. In this case,
the back button is not drawn and the left item or items replace it. If you
would like the left items to appear in addition to the back button (as opposed to instead of it) set leftItemsSupplementBackButton
to true
.
@property(nonatomic) BOOL leftItemsSupplementBackButton
you can use something like this
navigationItem.leftBarButtonItem = editButton
//or
navigationItem.leftBarButtonItems = [editButton]
self.navigationItem.leftItemsSupplementBackButton = true