Hide Tab Bar in View with Push

How to hide parent tabbar when pushing controller in navigationController

After spending hours and posting a question here I found that the solution to this problem is adding the following line after the instantiation of ArticleController.

articleController.hidesBottomBarWhenPushed = YES;

how to hide tab bar when push and show tab bar when back

Edit: That solved the problem.

It makes sense that the tab bar is appearing because when going clicking back from VC2 to VC3, nothing is telling VC3 to hide its Tab Bar.

I think you have 2 solutions here (but haven't tested any):

  1. You can try doing something like this guy did. He added the hidesBottomBarWhenPushed logic in BackButtonPressed Handler.
  2. In VC3, do self.tabBarController?.tabBar.hidden = true in ViewDidLoad or viewWillAppear

How to hide the tabBar when push a view?

use this methood in the UIViewController class where you want to hide the tabBarController

-(BOOL)hidesBottomBarWhenPushed
{
return YES;
}

Update

As suggested by @Yuchen Zhong in his answer, This option is now available in the storyboard itself.

Sample Image

How do you hide/unhide the tab bar when pushing/popping

I actually figured it out. Basically in your viewdidAppear you add in self.hidesBottomBarWhenPushed = true and in your viewDidDisappear you add in
self.hidesBottomBarWhenPushed = false. Thanks for your guys's answers anyways.

hide / show tab bar when push / back. swift

As it's name suggest, hiddenBottomBarWhenPushed only hide bottom bar if needed, it will not unhide bottomBar.
You can do this to get it works:

override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
self.tabBarController?.tabBar.hidden = true/false
}

or simply put self.tabBarController?.tabBar.hidden = true/false in prepareForSegue

But I would not recommend you to do so, as it would be weird if bottomBar suddenly popped out, user will thought they suddenly back to rootViewController while they are not.

Users should always know where they are in your app and how to get to their next destination.

Hide TabBar when pushed into the navigation stack and bring it back when popped out of the navigation stack

Ok, So finally I got my answer, this is what I am suppose to do.

self.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:aViewController animated:YES];
self.hidesBottomBarWhenPushed=NO;

So basically hidesBottomBarWhenPushed = YES, and then push your view controller and then hidesBottomBarWhenPushed = NO; this works like a charm.

Thanks to eddy and his post here



Related Topics



Leave a reply



Submit