I want to disabled the default back button of navigation controller
self.navigationItem.rightBarButtonItem.enabled = NO;
// Below code does not work since leftBarButtonItem is always nil.
self.navigationItem.leftBarButtonItem.enabled = NO;
I have done it with manually shown below, But Is there any property to disabled the default back button with just single line?
backButton = [[UIButton alloc] initWithFrame:CGRectMake(5, 5, 100, 30)];
[backButton setBackgroundImage:[UIImage imageNamed:@"backbutton_100.png"] forState:UIControlStateNormal];
[backButton addTarget:self action:@selector(backAction:) forControlEvents:UIControlEventTouchUpInside];
[backButton setTitle:@" All Customers" forState:UIControlStateNormal];
backButton.titleLabel.font = [UIFont boldSystemFontOfSize:12];
[buttonView addSubview:backButton];
UIBarButtonItem* leftButton = [[UIBarButtonItem alloc] initWithCustomView:buttonView];
self.navigationItem.leftBarButtonItem = leftButton;
[leftButton release];
// Now it is working.
self.navigationItem.leftBarButtonItem.enabled = NO;
Yes, the back button can be disabled. Please navigate to Advanced Website Kiosk Settings–>Navigation–>Disable back button. Kindly enable this restriction to disallow the usage of the back button on the iOS device.
Go to attributes inspector and uncheck show Navigation Bar to hide back button.
Its very easy ..... just try this out
self.navigationController.navigationBar.userInteractionEnabled = NO; //for disabling
self.navigationController.navigationBar.userInteractionEnabled = YES; //for again enabling
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