Navigation bar not appearing?

五迷三道 提交于 2019-12-04 04:16:19

You're presenting your ViewController like this:

let vc = storyboard!.instantiateViewControllerWithIdentifier("TutorSignUp") as! SignUpViewController
self.presentViewController(vc, animated: true, completion: nil)

so your SignUpViewController doesn't actually have a UINavigationController as a parent.

This will fix that:

let vc = storyboard!.instantiateViewControllerWithIdentifier("TutorSignUp") as! SignUpViewController
let navigationController = UINavigationController(rootViewController: vc)
self.presentViewController(navigationController, animated: true, completion: nil)

Xcode 8.3+

Click on the view controller and select the following option:

Editor > Embed in > Navigation Controller

That should do it.

ryosuke-hujisawa

You need new UINavigationBar in StoryBoard then you will @IBOutlet

@IBOutlet weak var NavigationBar: UINavigationBar!

and you will addSubvie UINavigationBar

override func viewDidLoad() {
    super.viewDidLoad()

    self.view.addSubview(NavigationBar)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!