0
votes

I have two controller, main and detail, embed with navigationController and TabBarController; now I need to hide TabBar when performing the segue; I tried:

  • in main controller adding controller.hidesBottomBarWhenPushed = true in preparefor(segue9 method;
  • in detail controller adding self.hidesBottomBarWhenPushed = true in viewDidAppear or viewWillAppear;
  • in main controller adding self.hidesBottomBarWhenPushed = true in viewDidAppear or viewWillAppear.

But no one solve my problem. How could I hide the TabBar and then make it visible when users touch navigationController back button?

3

3 Answers

1
votes

show tabBar

self.tabBarController?.tabBar.isHidden = false

hide tabBar

self.tabBarController?.tabBar.isHidden = true
-1
votes

Hook up your tabBar in your ViewController so you can reference it.

Then:

You can simply use this in your ViewDidLoad() method.

self.tabBarController?.tabBar.hidden = true

Or you can change z position of tab bar this way:

self.tabBarController?.tabBar.layer.zPosition = -1

and if you want to show it again then:

self.tabBarController?.tabBar.layer.zPosition = 0
-1
votes

You can do that by the Interface Builder:

enter image description here