【发布时间】:2016-06-06 15:07:22
【问题描述】:
UIViewController 如何/何时可以返回 self.storyboard nil。
我正在尝试使用以下方法实例化 ViewController:
self.storyboard!.instantiateViewControllerWithIdentifier
但是 self.storyboard 为零?
注意:plist 设置为正确的故事板。
【问题讨论】:
-
If the view controller was not instantiated from a storyboard, this property is nil.(来自文档)。您的UIViewController是如何创建的? -
你是对的,ViewController 是在代码中创建的,因此故事板是 nil。答案是创建您自己的实例。
-
这听起来可能是 X/Y 问题。
标签: ios swift interface-builder uistoryboard