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?
For making hidden, try with assigning nil
to your rightBarButtonItem
like below.
self.navigationItem.rightBarButtonItem = nil ;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With