Aleks G Aleks G - 1 year ago 105
iOS Question

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

In my app I have at least a dozen

, 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
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 Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download