Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Showing a toolbar in pushed view controller in tab bar controller

I have a navigation controller in a tab bar controller. When I push a new view controller I want to show the toolbar. I'm doing that like this from the pushed view controller.

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [self.navigationController setToolbarHidden:NO animated:NO];
}

This works but the toolbar slides up from it's normal position where the tab bar is to go above it. I want it to appear without this "slide up" animation above the tab bar. Is that possible?

Here is my setup. The "slide up" animation occurs when pushing from view controller 1 to view controller 2. I only want the toolbar to appear in view controller 2.

[Tab Bar Controller]
  - [Navigation Controller]
     - [View Controller 1] -> Push -> [View Controller 2]
like image 629
Berry Blue Avatar asked Feb 07 '23 12:02

Berry Blue


2 Answers

Put your navigation controller embedded inside in your tab bar controller instead of the other way around.

So the tab bar will have the Nav bar as one of its view controllers

like image 193
Tomer Even Avatar answered Feb 13 '23 06:02

Tomer Even


Have you tried destinationVC.hidesBottomBarWhenPushed = YES;?

Apple docs

like image 33
tommybananas Avatar answered Feb 13 '23 06:02

tommybananas