Does anyone know how to hide a rightBarButtonItem
of a UINavigationController
? In my application, I have an edit button as a rightBarButtonItem>
To Hide the right button: self.navigationItem.rightBarButtonItem = nil;
Now, to show it:
If you setup the right button in your view controller by assigning it to self.editButtonItem then simply assign it again in order to show it:
self.navigationItem.rightBarButtonItem = self.editButtonItem;
If you setup the right button in your view controller by allocating and initing a UIBarButtonItem, then simply keep a reference to the UIBarButtonItem in your view controller, and assign it again when you need to show it.