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).
2
Answers
You must use presentViewController, not push.
In storyboard, go to the
UIViewController
you are going to push.Go to attributes inspector and check "Hide Bottom Bar on Push"
This can also be done programmatically:
Hope it helps!