Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS TabbarViewController hide the tab bar

Tags:

I have a viewcontroller that it implement UITabbarViewController, and I want to hide the tab bar and override it by myself,

self.tabBar.hidden = YES; 

the tab bar disappeared BUT there is a blank area(the blue one) at the bottom of the view. I dont want the blank area , how can I fix this? Thank you.

edit: the blue area is:

self.view.backgroundColor = [UIColor blueColor]; 
like image 685
jxdwinter Avatar asked Mar 08 '13 14:03

jxdwinter


People also ask

How do I hide a tab bar?

Hide Tabs Using F11 Shortcut Pressing the F11 button on your keyboard makes Google Chrome go into full-screen view. This, in turn, hides the address bar and all the tabs from the toolbar menu.

How do you hide the tab bar when a view controller is shown?

If you don't want that behavior, you should set hidesBottomBarWhenPushed to true where applicable. This will hide the tab bar along with any toolbars you had showing, but only when a view controller is pushed onto the navigation stack. This allows you to show the tab bar at first, then hide it when you need more room.

How do I get rid of the tab bar 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.


2 Answers

We've done exactly the same in our application. To hide the default TabBar, simply override the hidesBottomBarWhenPushed method in your parent view controller (or in every view controller in your App)

#pragma mark - Overriden UIViewController methods - (BOOL)hidesBottomBarWhenPushed {     return YES; } 

EDIT: This value can also be set from Storyboard:

enter image description here

like image 52
redent84 Avatar answered Sep 20 '22 06:09

redent84


My UITabBarController is housed within a container view. Checking "Hide Bottom Bar on Push" was not working for me. Instead I created a subclass of the tab bar controller and hid the tab bar programmatically.

class FooTabBar: UITabBarController {   override func viewDidLayoutSubviews() {     super.viewDidLayoutSubviews()     self.tabBar.isHidden = true   } } 
like image 24
Mark Suman Avatar answered Sep 20 '22 06:09

Mark Suman