0
votes

I have a Navigation Controller after Tab Bar Controller like this

this

I want to hide the navigation bar on the first page but it still won't hide if I open the application.

I have done the following:

  1. uncheck "Shows Navigation Bar" on Navigation Controller
  2. add this code under "viewWillAppear" on the first page ViewController:

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

When I click the Back Button, it shows my splashscreen page, if I go next it goes to the First Page but the navigation bar is hidden.

This is the page when I open the application

this is the page when I open the application

This is when I click back and go to the same page

this is when i click back

Do you know what I missed to make the navigation bar hidden from the very beginning.

2

2 Answers

0
votes

you can do this way.

localNavigationController = [[UINavigationController alloc] initWithRootViewController:theViewController];
[localNavigationController setNavigationBarHidden:YES animated:YES];
0
votes

First of all,I will go to solve your problem.And then I will state about UINavigationController.

So you use SB create some viewControllers in Main.storyboard.These viewControllers must should inherit UITabBarController,UINavigationController or ViewController. I see your screenshoot that is right,otherwise your screenshoot is unclearly.

If you want to edit or layout view,you need to create ViewController and match this ViewController with in Main.storyBoard.I will test these operation.you will can this.

ViewControllers Match this And then these ViewControllers inherit match ViewController.

HomeTabBarViewController

HomeTabBar HandCode ScreenShot

FirstViewController FirstVC

SecondViewController

SecondVC

As mentioned above,that is very clearly. if you want to hiddn navigationBar in this first page,you must handwritten code in FirstViewController.Also you operate in viewWillAppear:

self.navigationController.navigationBar.hidden = YES;

that's all.

If you handwritten code hidden navigationBar in HomeTabBarViewController inherit UITabBarController,because navigationController is next ViewController that is not work in hidden code.

So UINavigationController have auto create navigation bar.You want to not show this navigation bar to use hidden navigation bar in viewWillAppear.And also you want to hidden this page and next page show,you can this viewWillAppear to hidden,viewWillDisAppear to show.

I wish can help you for resolve problem.