Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I show a tabbar when pushing a UIViewController onto the Navigation stack

So it is very easy to hide the tabbar when you push a view controller onto the navigation controller stack:

uiViewController.hidesBottomBarWhenPushed = YES;

works just peachy.

Put let's say I want to push deeper into the stack and show it again?

Setting

 laterUIViewController.hidesBottomBarWhenPushed = NO; 

on some later view controller doesn't make it reappear. It's still hidden.

like image 400
Carl Coryell-Martin Avatar asked Aug 27 '09 03:08

Carl Coryell-Martin


2 Answers

You could try subclassing UIViewController and overriding the

- (void)viewWillAppear:(BOOL)animated { self.hidesBottomBarWhenPushed = YES; }
- (void)viewWillDisappear:(BOOL)animated { self.hidesBottomBarWhenPushed = NO; }

And then using that subclass as the superclass of the view controller that you want to show the bottom bar.

like image 70
Joe V Avatar answered Sep 23 '22 03:09

Joe V


This worked for me:

- (void)viewWillAppear:(BOOL)animated { self.tabBarController.tabBar.hidden = YES; }
- (void)viewWillDisappear:(BOOL)animated { self.tabBarController.tabBar.hidden = NO; }
like image 29
Eran Talmor Avatar answered Sep 22 '22 03:09

Eran Talmor