I need to hide the right button in the Navigation Bar, then unhide it after the user selects some options.
Unfortunately, the following doesn\'t work:
Credit has to go to learner for this answer which the answer is from this question:
hide and show left navigation bar button on demand in iOS-7
This is the answer, which is far more simple.
//hide and reveal bar buttons
-(void) hideAndDisableLeftNavigationItem
{
[self.navigationItem.leftBarButtonItem setTintColor:[UIColor clearColor]];
[self.navigationItem.leftBarButtonItem setEnabled:NO];
}
-(void) showAndEnableLeftNavigationItem
{
[self.navigationItem.leftBarButtonItem setTintColor:[UIColor blueColor]];
[self.navigationItem.leftBarButtonItem setEnabled:YES];
}
Then you just reference the method where you require it like within an (IBAction)
like so:
[self hideAndDisableLeftNavigationItem];//[self showAndEnableLeftNavigationItem]; to show again
I tried all other methods and none worked, even referencing my button as a @property (...) UIBarButtonItem....
and nothing worked until I found this.