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.
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.
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.
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 .
Make sure to check this option only on the ViewController whose tab bar you wish to be hidden.
Thanks to iHarshil for the suggestion.
In the viewDidload
set the UIViewController hidesBottomBarWhenPushed
to yes:
self.hidesBottomBarWhenPushed = YES;
This way the UINavigationController
takes care of hiding the tab bar.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With