Aleks G Aleks G - 25 days ago 11
iOS Question

self.navigationController.navigationBar.hidden = TRUE does not work on one UIViewController

In my app I have at least a dozen

UIViewController
, some of them show navigation bar, some of them don't. Everything works fine on all but one controllers.

I navigate to this screen from another one that does not have the nav bar shown. On this one, I need the nav bar shown, so in my
viewWillAppear
I have this code:

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


When I step through the code with a debugger, I go through this line, however it's just ignored and the nav bar is not shown. This appears to be a problem on both the simulator and an actual device (iPhone 4S with iOS 5.1.1).

What am I missing here?

Answer

I guess, I hit another one of those Apple "just bloody do it" things.

In addition to having that line in the viewWillAppear method, I added this to viewDidLoad:

self.navigationController.navigationBarHidden = NO;

Now it work as I want it. Interestingly, if I remove either of the two lines, it doesn't work; it only works with both lines in place.

Whatever, it works now.