3

In my Main Window IB file I have a TabBarController and the first controller is a Navigation Controller. When I push my detail view (after pressing a cell in a table view) I want to push my detail view and display a tool bar instead of the tab bar. The problem is that when I try

 tabBar.hidden = visible;

in my detail view controller (viewDidLoad) the tabbar dissapears before the animation between the first view and the detail view is done.

What i want to achieve can be seen in the native photo app when pressing on one of the images from a gallery. There the tabbar moves out with the animation of the first view.

How do I achieve this?

Thanks in advance

Michael Eakins
  • 4,149
  • 3
  • 35
  • 54
Erik
  • 5,791
  • 5
  • 30
  • 45

1 Answers1

5

check out the 'hidesBottomBarWhenPushed' property on your detail's page subclass of UIViewController

either override this method

- (BOOL)hidesBottomBarWhenPushed
{
    return YES;
}

or i'm guessing this would work the same:

self.hidesBottomBarWhenPushed = YES;

as far as showing the toolbar try:

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

and on the way out

- (void)viewWillDisappear:(BOOL)animated
{
    [self.navigationController setToolbarHidden:YES animated:YES];
}
Sebastian Bean
  • 142
  • 2
  • 8
  • Thanks for the answer. Here's some additional code from another answer that could be added to keep the toolbar visible as the user drills down. http://stackoverflow.com/questions/1816614/viewwilldisappear-determine-whether-view-controller-is-being-popped-or-is-showin – sho Sep 05 '11 at 22:15
  • Great! But don't know why `self.navigationController.toolbar.hidden = YES;` not works! What's the difference between `toolbarHidden` and `toolbar.hidden`? – Nianliang Oct 22 '16 at 18:42
  • Have also to make following checkboxes checked in storyboard: 1. Shows Toolbar attribute of Navigation Controller, 2. Hidden attribute of that Toolbar. – Nianliang Oct 22 '16 at 19:09