呈现View时导航栏不显示?

时间:2017-09-14 11:58:57

标签: ios swift xcode uinavigationbar

选择此行代码时,导航栏不会出现

  self.present(vc, animated: true, completion: nil)

但是在试用这段代码时

let vc = storyboard.instantiateViewController(withIdentifier: "view")
let navController = UINavigationController(rootViewController: vc)
self.present(vc, animated: true, completion: nil)

我的应用崩溃,发出错误

NSInvalidArgumentException', reason: 'Application tried to present modally an active controller 

在呈现视图而不是推动视图时,请帮助我获取导航栏

1 个答案:

答案 0 :(得分:3)

尝试这样做 -

self.present(navController, animated: true, completion: nil)