IPhone: back navigation bar clickable button = NO?

I know that we can hide the back navigation bar. But I do not want to hide it! Is there a way to make this just not clickable?

+6
source share
9 answers

try it

self.navigationItem.leftBarButtonItem.enabled=NO; self.navigationItem.backBarButtonItem.enabled=NO; 

Update:

Apple doesn't seem to be able to enable / disable the back button. Instead, we can hide it.

  self.navigationItem.hidesBackButton = YES; 
+8
source

You cannot disable backBarButtonItem. Setting the included backBarButtonItem property to NO does not actually disable it.

Apple seems to have forbidden others ("us") to disable the backBarButtonItem, even if it ignores the target and action set to the backBarButtonItem.

+11
source
 self.navigationItem.backBarButtonItem.enabled = NO; 
+4
source

The default cancel button cannot be disabled because Apple does not enable this feature.

+2
source

Disable:

 self.navigationItem.leftBarButtonItem.enabled = NO; 

Include:

 self.navigationItem.backBarButtonItem.enabled = YES; 
+2
source

This does not work with the back button by default. But you can hide the default back button [self.navigationItem setHidesBackButton:YES];

+1
source

Yes, you can disable this button, only the setenabled property of this button is NO.

0
source

The button must be disabled:

 backButton.enabled = NO; 
0
source

Apple doesn't want you to disable it, but you can hide it, of course.

 self.navigationItem.hidesBackButton = YES; 

This works especially well if you have a custom UIBarButtonItem as a button.

In applications in the warehouse, you will notice that functions that are not applicable are hidden at all, and not disabled.

0
source

Source: https://habr.com/ru/post/893267/


All Articles