UINavigationItem setHidesBackButton:YES won't prevent from going back
-
22-07-2019 - |
Question
It's odd, I know, but even if you stated hidesBackButton to YES for the UINavigationItem associated with your view, you will be able to go back just touching the area that was meant to be a back button.
Sharing my solution... (more to come)
Solution
First I thought it was a simulator bug and uploaded to the device. But when I reproduced the same behavior there as well I started to think how to get rid of such behavior (since it was essential for me). Came up to such a solution:
[self.navigationItem setLeftBarButtonItem:[[[UIBarButtonItem alloc] initWithCustomView:[[UIView new] autorelease]] autorelease]];
And to show the back button again you write:
[self.navigationItem setLeftBarButtonItem:nil];
That's simple. Use it as a work-around, guys! Very strange this bug survived even in iPhone OS 3.0...
OTHER TIPS
i think hiding back bar button also work as
self.navigationItem.hidesBackButton = TRUE;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow