Search code examples
iosobjective-cswiftuitabbarcontroller

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!


Solution

  • 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