Hide Bottom Bar Navigation Controller

12,502

Solution 1

You can't set this in Interface Builder. If you notice the header of the section in IB where you can turn on/off these different bars, it says "simulated". These options are only there to help you visualize your UI in IB while designing it. They have absolutely no influence on the running app.

Solution 2

I couldn't do it in storyboard when you just want to hide toolbar in one view controller. If you want to hide it for all, you need to go to the navigation controller, and set the values in the storyboard. But this makes all of your view controllers to hide the toolbars. If you want to hide it for one view controller use this in that view controller:

-(void) viewWillAppear:(BOOL)animated
{
    [self.navigationController.toolbar setHidden: YES];
}

-(void) viewWillDisappear:(BOOL)animated
{
    [self.navigationController.toolbar setHidden: NO];
}

Solution 3

Enable "Hides Bottom Bar on Push" within the IB in case your ViewController is pushed onto a UINavigationController stack.

This should exactly do what you are asking for. As a bonus, the hiding and showing will be nicely animated by the system.

Share:
12,502
Baub
Author by

Baub

Updated on June 22, 2022

Comments

  • Baub
    Baub almost 2 years

    I want to hide the bottom toolbar on a certain screen in my application, and IB seems to have an option for that which seems to preview as working correctly, but when I build and test the application the bottom toolbar is still there.

    I know that I can use [self.navigationController setToolbarHidden:YES]; but my question is not how to do it using code, but how to get this to work through Interface Builder.

    enter image description here

    Here is a screenshot of what I am talking about. See on the right how I have selected Bottom Bar: None - this removes the bottom bar as previewed to the left. If I set it to inferred (instead of None) the bottom bar shows in the IB preview.

    How do I get this to work correctly?

  • Baub
    Baub over 12 years
    'doh! So should I just use the code in the viewWillAppear and viewWillDisapper methods to hide it and bring it back respectively?
  • Ole Begemann
    Ole Begemann over 12 years
    Yes, that's what you should do.
  • mostafa tourad
    mostafa tourad over 12 years
    Also note that there is an option called "Hides Bottom Bar on Push" which will do what you are asking for in case the ViewController in question is pushed onto a navigation stack.
  • Baub
    Baub over 12 years
    Is there any way to animate this?
  • mostafa tourad
    mostafa tourad over 12 years
    @James, my suggestion does animate the hide process, yes.
  • Baub
    Baub over 12 years
    @Till I see a problem with this: When I get pushed back to that initial view controller that DOES have the toolbar, it doesn't have the toolbar when I get back to it.
  • Baub
    Baub over 12 years
    I see a problem with this: When I get pushed back to that initial view controller that DOES have the toolbar, it doesn't have the toolbar when I get back to it.
  • mostafa tourad
    mostafa tourad over 12 years
    @James just have a peek at stackoverflow.com/questions/5072382/…
  • Rudolf Adamkovič
    Rudolf Adamkovič over 11 years
    @James That can be solved by setting UINavigationController's Shows Toolbar option.
  • enagra
    enagra almost 11 years
    It is not right what @OleBegemann says. Is not simulated. It works perfectly, at least in XCode Version 4.6.3