2015-10-08 49 views
1

我賽格瑞與錯誤返回從這一行> self.navigationController(展開一個可選值)?....導航Segue公司不能正常工作的iOS斯威夫特

在我的代碼...

let nextScreen = self.storyboard!.instantiateViewControllerWithIdentifier("onboarding-what") as? ViewController 
     self.navigationController?.pushViewController(nextScreen!, animated: true) 

這上面的代碼在我入職開始視圖控制器實現

這是我的故事板設置... enter image description here

最後一個視圖控制器具有日「onboarding-what」的ID。

我已閱讀導航控制器的文檔,但似乎無法找到我的問題。有沒有人有辦法解決嗎?

回答

1

您可以使用performSegueWithIdentifier而不是pushViewController如果你在故事板

「入職,什麼」在storyboardId領域將它們連接在一起但是你填? pls check this image

而且「入職,什麼」視圖控制器應的ViewController (有沒有默認的類名爲「視圖控制器」唯一「的UIViewController」或「NSViewController」的OSX)的實例

+0

良好的漁獲,謝謝! –

1

顯然nextScreen爲零。這是最有可能"onboarding-what"標識符不正確