ios - 导航 Controller 无法正常工作

标签 ios swift uiviewcontroller uinavigationcontroller

在显示第一个 VC 后,我有了导航 Controller 。我正在使用 perform segue 通过 performSegue(withIdentifier: "secondVC", sender: nil) 从第一个 vc 导航到第二个页面,我的边栏出现了。但是,当我尝试从 First vc 转到第三页时,它没有导航。所以,我尝试使用以下代码

let thirdVC = self.storyboard?.instantiateViewController(withIdentifier: "thirdVC") as! ThirdVC
navigationController?.pushViewController(thirdVC, animated: true)

它工作正常,但当我使用上面的代码时,我的导航栏消失了。我怎样才能从第一个 vc 到第三个?

enter image description here

最佳答案

你可以试试这个

let thirdVC = self.storyboard?.instantiateViewController(withIdentifier: "thirdVC") as! ThirdVC
navigationController?.isNavigationBarHidden = false  
//Make sure navigation controller should be there
navigationController?.pushViewController(thirdVC, animated: true)

关于ios - 导航 Controller 无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48865851/

相关文章:

ios - map View 显示我的位置和目的地,但不显示它们之间的方向

ios - 使用 AVCaptureSession 录制视频,添加 CIFilter 并保存到相册

ios - 向导航 Controller 添加另一个后退按钮

iphone - iOS SDK - 以编程方式生成 PDF 文件

ios - 错误 : Index out of range in segment control

ios - 在 Titanium Studio 中处理 iOS 的方向变化?

ios - 应用内购 : How to save the effect of the purchase

ios - 旋转时,文本在 UITextView 行尾之前断到下一行

iphone - 如何以编程方式在 UINavigationController 中按下 "Back"按钮

ios - 在 iOS 7 中动态更改 UIViewController 的 View