Home > Back-end >  How to push UIViewController overCurrentContext using UINavigationController
How to push UIViewController overCurrentContext using UINavigationController

Time:04-06

I have a UIViewController that contains a UITabBar. I want to push a new UIViewController that covers the current context (so during the animation it shows the new UIViewController covering the UITabBar). How can I do this?

I have tried using the following to push the view but this is not pushed over the UITabBar.

let vc = ViewController2()
vc.modalPresentationStyle = .overFullScreen
navigationController?.pushViewController(vc, animated: true)

I also thought that maybe I could just hide the UITabBar on ViewController2's viewWillAppear and show it on its viewWilDisappear; however, this just makes the UITabBar appear halfway through the dismissal (it looks really bad if you slowly slide to dismiss the view).

CodePudding user response:

You must use presentViewController, not push.

CodePudding user response:

In storyboard, go to the viewcontroller you are going to push. Go to attributes inspector and check "Hide Bottom Bar on Push"

Hope it helps!

  • Related