Reputation: 621
I use following method to disable the Navigation bar throughout the app:
[navcontroller setNavigationBarHidden:YES animated:YES];
But is it possible to disable it only for one ViewController
?
Upvotes: 0
Views: 87
Reputation: 4331
The nicest solution I have found is to do the following in the first view controller.
- (void)viewWillAppear:(BOOL)animated
{
[self.navigationController setNavigationBarHidden:YES animated:animated];
[super viewWillAppear:animated];
}
- (void)viewWillDisappear:(BOOL)animated
{
[self.navigationController setNavigationBarHidden:NO animated:animated];
[super viewWillDisappear:animated];
}
This will cause the navigation bar to animate in from the left (together with the next view) when you push the next UIViewController on the stack, and animate away to the left (together with the old view), when you press the back button on the UINavigationBar.
Please note also that these are not delegate methods, you are overriding UIViewController's implementation of these methods, and according to the documentation you must call the super's implementation somewhere in your implementation.
Hopefully this will resolve your problem.
Upvotes: 0
Reputation: 5953
Certainly. Whenever you enter a viewcontroller, you can enable or disable for that viewcontroller (just call [[self navigationController] setNavigationBarHidden:YES animated:YES]
during viewWillAppear
Upvotes: 1