'How to push UIViewController overCurrentContext using UINavigationController
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).
Solution 1:[1]
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:
let vc = viewController1()
vc.hidesBottomBarWhenPushed = true
navigationController?.pushViewController(vc, animated: true)
Hope it helps!
Solution 2:[2]
You must use presentViewController, not push.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | helloworld12345 |
| Solution 2 | Cavidan M?mm?dli |
