Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable the right bar button of navigation

self.navigationItem.rightBarButtonItem.enabled = FALSE;
[activityIndicator startAnimating];
//[myview sendSubviewToBack:self.view];
//self.view.hidden= TRUE;
myview.hidden= FALSE;
activityIndicator.hidden= FALSE;
dt = [[DateTime alloc] init];

This is my method in this when user click on leftbar button of navigation this method fires here i want to disable the button but its not getting disable and i checked my code i am not enabling it anywhere.......Please help me

like image 997
madhavi Avatar asked Apr 16 '10 13:04

madhavi


People also ask

How do I disable the navigation bar button?

Way 1: Touch “Settings” -> “Display” -> “Navigation bar” -> “Buttons” -> “Button layout”. Choose the pattern in “Hide navigation bar” -> When the app opens, the navigation bar will be automatically hidden and you can swipe up from the bottom corner of the screen to show it.

How do I disable navigation items?

Go to the theme and there is an option to remove them completely under System UI. The remove option requires the immersive mode first. Make sure you have your gestures navigation working prior to remiving the Nav Bars. I use Edge Gesture myself and it works great.

How do I disable navigation buttons in Swift?

Swift 5 & iOS 13 :Navigation bar button items must be toggled by referring to them via the navigationItem property. For example: func setupNav() { let saveButton = UIBarButtonItem.


2 Answers

Just

self.navigationItem.rightBarButtonItem.enabled = NO;
like image 65
beryllium Avatar answered Sep 24 '22 18:09

beryllium


If properties aren't initialised properly in Objective-C you won't see any errors, the statement just won't get executed..

My first guess would be that you're calling a method on a nil reference.

Use the debugger to see whether the rightBarButtonItem has been set up properly.

like image 32
Steve Neal Avatar answered Sep 24 '22 18:09

Steve Neal