views:

519

answers:

2

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.

A: 

If you don't want a back button then you should probably not put your view controllers in a navigation view controller.

St3fan
I do want a navigationcontroller, I just want to disable the button while I'm doing some dataparsing.
Glenn
+2  A: 

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.

Yarek T
Good thing about hiding the navBar is that after you finished parsing you can unhide it with animation and you will get a nice sliding animation from the top =)
Yarek T