Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swift - Present another view controller with its navigation bar

I have two ViewControllers -- one with storyboard and one without. Both of those view controllers have their own Navigation Bar at the top. Now when I use self.presentViewController(editorViewController, animated: true, completion: nil) my editorViewController comes up but without its Navigation bar.

Any ideas how to fix this?

like image 821
Vasil Nunev Avatar asked Feb 16 '26 20:02

Vasil Nunev


2 Answers

I fixed the problem using the following code:

let editorViewController = IMGLYMainEditorViewController()
let navEditorViewController: UINavigationController = UINavigationController(rootViewController: editorViewController)
self.presentViewController(navEditorViewController, animated: true, completion: nil)

I just added the navEditorViewController as it made my navigation bar with its items to appear.

like image 86
Vasil Nunev Avatar answered Feb 18 '26 12:02

Vasil Nunev


Try self.navigationController!.pushViewController(...)

like image 25
David P Avatar answered Feb 18 '26 10:02

David P



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!