Navigation bar disappears when soft pressed

I have been working on the application for a while, and it pushes the view controller from AppDelegate. When the navigation bar that was previously pressed disappears. This is now a static navigation bar (not part of the navigation controller), but it was previously and still didn't work. What am I doing wrong? Is there any workaround?

This is the code in AppDelegate that I use to push it:

var storyboard = UIStoryboard(name: "Main", bundle: nil) var PostView: AnyObject! = storyboard.instantiateViewControllerWithIdentifier("NewView") var rootViewController = self.window!.rootViewController as! UINavigationController rootViewController.pushViewController(PostView as! UIViewController, animated: true) 

pushViewController is the one I'm trying to click.

+8
ios swift uinavigationcontroller
source share
3 answers

On the view controller that you are trying to click, using the viewDidLoad method viewDidLoad try to make the navigation bar not hide

 self.navigationController?.setNavigationBarHidden(false, animated: false) 

If this helps, check the view controller on the storyboard, if you do not force the view controller to hide the navigation bar

Hope this helps :)

+7
source share

Try the following:

 var storyboard = UIStoryboard(name: "NewStoryBoard", bundle: nil) let vc = storyboard.instantiateViewController(withIdentifier: "NewView") as! UIViewController self.navigationController?.pushViewController(vc, animated: true) 
+1
source share

rootViewController - UINavigationController . Whichever controller you click on it will use the UINavigationBar defined in this UINavigationController .

If you do not want the "automated" UINavigationBar that comes with the UINavigationController to simply set some other type of view controller as the initial one (or not set the view controller as the initial one).

0
source share

All Articles