Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable navigationitem backbarbutton

How do I disable the backbutton in a navigationcontroller?

When I hide the button like so, self.navigationItem.hidesBackButton = TRUE; the buttonarea is still tappable.

like image 838
Glenn Avatar asked Feb 16 '10 16:02

Glenn


1 Answers

If you don't need a back button and since part of navigationBar's existence is to have a back button you can simply hide the navBar. I can post the code to that if you want as Im doing that in couple of projects. Otherwise have your "bug" might not be a bug if you are calling it from the wrong place. After digging i managed to come up with this. To hide the back button use:

self.navigationItem.hidesBackButton = YES;

To hide the whole navigationBar use:

self.navigationController.navigationBarHidden = YES;

But this will happen without animation, to animate it use this instead:

[self.navigationController setNavigationBarHidden:YES animated:YES];

This will make a sliding animation together with the navigation view. You will need to provide some other means for the person to get back tho.

like image 105
Yarek T Avatar answered Sep 30 '22 17:09

Yarek T