Case one:
To hide UITabbarController in a cetain UIVIewController, for example while calling self.performSegueWithIdentifier("Identifier", sender: self)
, it is necesssary prior to to that, set self.hidesBottomBarWhenPushed = true
flag. And after self.hidesBottomBarWhenPushed = false
flag. But we have to understad that through one UIViewController, UITabbarController will re-appear and, in case if you need to use UITabbarController with single UIViewControler, it wont yield right result.
in the FirstItemViewController
@IBAction func pushToControllerAction(sender: AnyObject) {
self.hidesBottomBarWhenPushed = true
self.performSegueWithIdentifier("nextController", sender: self)
self.hidesBottomBarWhenPushed = false
}
Case Two:
To hide UITabbarController in a certain UIVIewController, after which a UITabbarController should be popped, it is necessary, for example, while calling self.performSegueWithIdentifier("nextController", sender: self)
, to set self.hidesBottomBarWhenPushed = true
before the method. Alse willMoveToParentViewController(parent: UIViewController?)
in the method should be configured as it shown in the code example.
in the first UIViewController "FirstItemViewController"
@IBAction func pushToControllerAction(sender: AnyObject) {
self.hidesBottomBarWhenPushed = true
self.performSegueWithIdentifier("nextController", sender: self)
}
in the next UIViewController "ExampleViewController"`
override func willMoveToParentViewController(parent: UIViewController?) {
if parent == nil {
var viewControllers = self.navigationController!.viewControllers
if ((viewControllers[viewControllers.count - 2]).isKindOfClass(FirstItemViewController.self)) {
(viewControllers[viewControllers.count - 2] as! FirstItemViewController).hidesBottomBarWhenPushed = false
}
}
}
Swift 3 code:
let viewControllers = self.navigationController!.viewControllers
if ((viewControllers[viewControllers.count - 2]) is (FirstItemViewController)) {
(viewControllers[viewControllers.count - 2] as! FirstItemViewController).hidesBottomBarWhenPushed = false
}
Test project