Xcode无法更改View Controller

时间:2018-01-31 15:34:58

标签: xcode pushviewcontroller

let profileViewController = 
self.storyboard?.instantiateViewController(withIdentifier: 
"ProfileViewcontroller") as! ProfileViewController

self.navigationController?.pushViewController(profileViewController, 
animated: true)

http://prntscr.com/i87reg

不明白,为什么会这样。

1 个答案:

答案 0 :(得分:0)

您可以尝试初始化故事板吗?

故事板或navigationController都是零。

 let storyboard = UIStoryboard(name: "Main", Bundle: Bundle.main) 
 let profileViewController = storyboard.instantiateViewController(withIdentifier: "ProfileViewcontroller") as! ProfileViewController
 self.navigationController?.pushViewController(profileViewController, animated: true)

enter image description here enter image description here