导航控制器无法正常工作

时间:2018-02-19 12:04:23

标签: ios swift uiviewcontroller uinavigationcontroller

显示第一个VC后我有导航控制器。我正在使用perform segue从第一个vc导航到第二页performSegue(withIdentifier: "secondVC", sender: nil)并且我的侧边栏正在出现。但是,当我试图从第一个vc进入第三页时,它不会导航。所以,我尝试使用以下代码

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

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

enter image description here

1 个答案:

答案 0 :(得分:1)

你可以试试这个

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