Reputation: 4087
in the Storyboard (Xcode 6, iOS 8 and swift) i have embedded a TableViewController in a Navigation Controller.
From the object library, i have drag & drop a Bar Button Item as the back button and it show an icon image: when i click that button i show a setting view.
How can i hide that button? In the viewDidLoad() i've tried:
self.navigationItem.hidesBackButton = true;
The code is executed (i've tried with the debugger) but the button is always visible.
Upvotes: 13
Views: 19458
Reputation: 4590
SWIFT 3
self.navigationItem.setRightBarButton(nil, animated: true)
Upvotes: 5
Reputation: 755
Try this,
self.navigationItem.setLeftBarButtonItem(nil, animated: true)
Hope this helps.
Upvotes: 3
Reputation: 1296
If the bar button item is on the right side of the navigation bar you have to set
self.navigationItem.rightBarButtonItems = []
if the bar button item in question is on the left side do the same, it will remove the bar button items from the navigation item
Upvotes: 3
Reputation: 999
You have to try this:
self.navigationItem.setHidesBackButton(true, animated: false)
hope it helps you.
Upvotes: 23