My view controller have a back button show on navigation bar(in a UINavigationController). There is a "edit" mode in current view. When into "edit" mode, I replace the leftBarButtonItem to a "Cancel" button, when exit the "edit" mode, I want to change the left button to "back button" again, how can I do it?
I try self.navigationItem.leftBarButtonItem = self.navigationItem.backBarButtonItem, it just remove the "Cancel" button, but not get the "back button" back.
Now I can create a new navigation item with the UI just like the back button, and set it to as leftBarButtonItem, but the position is not same with the native back bar button, and lost the swipe back gesture.
Is there any way to get the native back bar button item back on the navigation bar?
When you leave edit mode, just set:
self.navigationItem.leftBarButtonItem = nil;