Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Hide the UInavigationBar Rightbarbutton item?

I added the info button to the navigation bar using below code:

UIButton *infoButton = [UIButton buttonWithType:UIButtonTypeInfoLight];
    [infoButton addTarget:self action:@selector(showImage:) 
         forControlEvents:UIControlEventTouchUpInside]; 
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:infoButton];

Now i want to hide this button at some part of the code based on some conditions. But i didn't find any hide property for right bar button item in the navigation bar?

like image 427
Vignesh Babu Avatar asked May 13 '11 17:05

Vignesh Babu


1 Answers

For making hidden, try with assigning nil to your rightBarButtonItem like below.

self.navigationItem.rightBarButtonItem = nil ;
like image 75
Jhaliya - Praveen Sharma Avatar answered Oct 07 '22 02:10

Jhaliya - Praveen Sharma