iOS TabbarViewController hide the tab bar

和自甴很熟 提交于 2019-11-28 19:16:43

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
  }
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!