我有登录,注册和重置viewControllers我已将UINavigation控制器连接到登录控制器但是当我通过单击signup
或reset password
按钮转到其他视图控制器时,目标控制器出现时没有导航酒吧。当我点击下面的按钮时,有助于以编程方式包含导航栏。
@IBAction func signupButton(_ sender: Any) {
let storyBoard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let newViewController = storyBoard.instantiateViewController(withIdentifier: "SignUpViewController") as! SignUpViewController
self.present(newViewController, animated: true, completion: nil)
}
答案 0 :(得分:1)
对于显示屏导航栏,您需要在SignUpViewController
中添加UINavigationController
,直接在故事板中添加<{p}}
选择SignUpViewController - &gt;编辑菜单 - &gt;嵌入 - &gt;导航控制器
或强>
您可以像这样以编程方式添加
IBAction func signupButton(_ sender: Any) {
let storyBoard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let newViewController = storyBoard.instantiateViewController(withIdentifier: "SignUpViewController") as! SignUpViewController
let naviCon = UINavigationController(rootViewController:newViewController)
self.present(naviCon, animated: true, completion: nil)
}