0

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

black_pearl
  • 2,549
  • 1
  • 23
  • 36
vijju
  • 462
  • 9
  • 30

2 Answers2

1

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
}
Shehata Gamal
  • 98,760
  • 8
  • 65
  • 87
0

You can use hidesBottomBarWhenPushedin the view controller which you don't need tabs. Fits your situation.

let controller = ViewControllerTwo()
controller.hidesBottomBarWhenPushed = true
navigationController?.pushViewController(controller, animated: true)

A little more explanation:

self.tabBarController?.tabBar.isHidden = true globally changed the self.tabBarController's property hideTabBar across its children controllers stack.

black_pearl
  • 2,549
  • 1
  • 23
  • 36