Neznayka
Neznayka

Reputation: 33

push / present view controller over tab bar Swift

I try to reproduce the same way to push the screen as in the fb messenger for example.

My schema: TabController -> NavController-> embedVC-> pushedVC.

The pushedVC must be over tabbar. I don't want to hide it with tabbar.isHidden = true.

Upvotes: 2

Views: 5603

Answers (2)

FredFlinstone
FredFlinstone

Reputation: 956

SWIFT 5 (works also on previous versions)

Before pushing the ViewController, set hidesBottomBarWhenPushed = true

Example:

let viewController = UIViewController()
viewController.hidesBottomBarWhenPushed = true
navigationController?.pushViewController(viewController, animated: true)

Upvotes: 4

ViR
ViR

Reputation: 286

Try to use UIViewController.hidesBottomBarWhenPushed = true on that screen where you need to hide the tab bar. You can also try to arrange the UITabBarController as child in UINavigationController. As far as I know (I can be wrong), UITabBarController will not work in the UINavigationController, so sometimes someone uses their custom TabBarController.

Upvotes: 6

Related Questions