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];
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:

I don't think there's an easy way to fix this because UITabbarViewController
is probably your super view and all "inner" views' height = screenHeight - tabBarHeight - navBarHeight
.
Maybe you can try to resize your inner view controller manually but then I think you might have problems with Apple's AppStore submission process, because I think this violates general iOS user experience.
And this is how you'd do the override (UIViewController
) in Swift:
override var hidesBottomBarWhenPushed: Bool {
get { return true }
set { super.hidesBottomBarWhenPushed = newValue }
}
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
}
}
来源:https://stackoverflow.com/questions/15296065/ios-tabbarviewcontroller-hide-the-tab-bar