I have found many posts, but still no solution. I am trying to hide a NavigationBar on the initial UIViewController
, but i want to still show it on the second UIViewController
. Here is my storyboard:
When I turn off the Inferred Top Bar for my Main View Controller, it disappears in Storyboard, but it still shows when I run the app. When I do the same in to the NavigationBar in NavController, it disappears for all three (because they all inherit the no Nav Bar).
I want to show the NavBar in ScrollViewV View Controller, but have it hidden in MainViewController
.
All Controllers have the corresponding .h or .m files, but I am confused on how to do this programmatically. Let me know if you need to see anything else. Thank you much!
In your mainViewController, you can do following:
- (void)viewWillAppear:(BOOL)animated
{
[self.navigationController setNavigationBarHidden:YES animated:animated];
[super viewWillAppear:animated];
}
You might want to show the Navigation bar when hiding this ViewController, for that do the following:
- (void)viewDidDisappear: (BOOL)animated
{
[self.navigationController setNavigationBarHidden:NO animated:animated];
[super viewDidDisappear:animated];
}