Reputation: 267
As the title indicates, the root view is my navigation controller, and it is set to be invisible, which it is on launch. However if I push a view onto the stack and then pop it the navigation bar appears.
Any clues as to why and how to remedy the situation?
Upvotes: 2
Views: 1813
Reputation: 33428
You need to hide it every time yours controller's view
appears (or disappears) on screen. This is necessary since the bar maintains the state among differents push/pop operations. For example, if you have set it hidden in viewDidLoad
within in first controller and in the second one you set it visible, when you pop the second controller the bar mantains the last state you have set.
For example override viewWillAppear
and viewWillDisappear
methods and hide/unhide the bar there.
- (void) viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[self.navigationController setNavigationBarHidden:YES animated:animated];
}
- (void) viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
[self.navigationController setNavigationBarHidden:NO animated:animated];
}
Upvotes: 2