Search code examples
swiftuinavigationcontrolleruitabview

How to display the tabs when click the back button from hided tab view controller


I created a tab bar controller and from one tab item I gave segue to the navigation view controller. And I create a some view controllers attached to navigation controller. So in one view controller I don't need a tabs so in that controller I wrote to hide the tab bar controller that is self.tabBarController?.tabBar.isHidden = true.

When I click the back button of navigation controller from hided tab view controller to previous controller, it doesn't show the tab bar items in previous controllers. But I needed tabs in all view controller except in one view controller. Why does it not show the tabs?

This is my story board :

enter image description here


Solution

  • You can try this in the VC that's before the one you hide the tab in

     override func viewWillAppear(_ animated:Bool) {
        super.viewWillAppear(animated)
        self.tabBarController?.tabBar.isHidden = false
    }