为什么导航栏没有立即显示,而只是在屏幕上几次转换之后才显示呢?
第一屏

第二屏

第三屏

第四屏

故事板之间的转换是通过代码完成的。
let storyboard = UIStoryboard(name: "detail", bundle: nil)
let vc = storyboard.instantiateViewController(withIdentifier: "Login") as! TwoViewController
self.present(vc, animated: true)发布于 2018-10-03 10:07:33
由于您是呈现视图控制器本身,它将没有任何导航控制器。如果需要显示带有导航控制器的视图控制器,请使用NavigationController而不是视图控制器。
let storyboard = UIStoryboard(name: "detail", bundle: nil)
let vc = storyboard.instantiateViewController(withIdentifier: "navigationControllerID") as! UINavigationController
self.present(vc, animated: true)或者用NavController编程包装VC。
let storyboard = UIStoryboard(name: "detail", bundle: nil)
let vc = storyboard.instantiateViewController(withIdentifier: "Login") as! TwoViewController
let nav = UINavigationController(rootViewController: vc)
self.present(nav, animated: true)https://stackoverflow.com/questions/52623900
复制相似问题