Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide the tabBar when push a view?

My application is a Tabbed Application, and it have several controllers under the tabBarController. One controller is a navigationController, and its root view is a table view. When I click a row of the table view, another view will be pushed in. So the question is that when the view is pushed in, how can I hide the tabBar at the bottom? Besides, I also want to add another tabBar into the pushed view, so I need to alloc a UITabBar or UITabBarController? Or there is another way? Thank you!

like image 763
wjldxt Avatar asked Jan 02 '12 13:01

wjldxt


People also ask

How do I hide a tabBar in Swift?

Simply, Go to ViewController (in StoryBoard) -> Attribute inspector -> Under 'View Controller' section select 'Hide Bottom Bar on Push' checkbox. This works like a charm.

How do I hide the bottom bar in Swift?

Answer: Use self. tabBarController?. tabBar. hidden instead of hidesBottomBarWhenPushed in each view controller to manage whether the view controller should show a tab bar or not.

How do I change the background color of a tabBar in Swift?

backgroundColor = UIColor(red:1, green:0, blue:0, alpha:1) / UITabBar. appearance(). tintColor = UIColor(red: 1, green: 0, blue: 0, alpha: 1) // New!!


1 Answers

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.

enter image description here

like image 93
Bonnie Avatar answered Oct 03 '22 00:10

Bonnie