Reputation: 60919
I have created my own leftBarButtonItem:
UIBarButtonItem* homeButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemBookmarks
target:self
action:@selector(homeButtonClicked:)];
self.navigationItem.leftBarButtonItem = homeButton;
How can I restore the original back button functionality programmatically?
Upvotes: 6
Views: 2112
Reputation: 17622
self.navigationItem.leftBarButtonItem = nil;
This will remove your custom left button, and the back button will appear again.
Upvotes: 4
Reputation: 1539
self.navigationItem.leftBarButtonItem = self.navigationItem.backBarButtonItem;
Upvotes: 38
Reputation: 25011
The back button will call UINavigationController
's popViewController
, so you can replicate that on your homeButtonClicked:
selector.
Upvotes: -1