Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

hide tab bar in view with push

I have a tabBar + NavigationViewController. The Tab bar has collection view with cells(Say view1) and with cells a push seague is implemented to another view(Say view2).

In view2 I want to have a navBar but no tab bar.

I tried

self.tabBarController?.tabBar.hidden = true,

it worked fine for view2 but when I went back to view1 by back button the tab was still hidden( even after in view1 class I added self.tabBarController?.tabBar.hidden = false in viewDidLoad func).

How can i make the tab bar reappear in view1?

I'm working in swift.

like image 260
Siddharth Somvanshi Avatar asked Nov 06 '14 13:11

Siddharth Somvanshi


People also ask

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 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 hide TabBar in NavigationView when using Swiftui?

If we want to hide the TabBar , we just write TabView into NavigationView , making the NavigationView the super-view and the TabView the child-view, which is just opposite to the above View Hierarchy .


2 Answers

enter image description here

Make sure to check this option only on the ViewController whose tab bar you wish to be hidden.

Thanks to iHarshil for the suggestion.

like image 137
Tiziano Bruschetta Avatar answered Sep 22 '22 05:09

Tiziano Bruschetta


In the viewDidload set the UIViewController hidesBottomBarWhenPushed to yes:

self.hidesBottomBarWhenPushed = YES; 

This way the UINavigationController takes care of hiding the tab bar.

like image 33
rckoenes Avatar answered Sep 22 '22 05:09

rckoenes