【发布时间】:2016-10-13 07:32:38
【问题描述】:
我想在 storyboard 中通过 init 传递值。在 xib 中使用的这段代码运行良好。但是在情节提要中,我的应用程序崩溃了。这是我的代码 sn-ps 请帮助任何帮助将不胜感激。
在FirstviewController中
let storyboard = UIStoryboard(name: "Main", bundle: NSBundle.mainBundle())
viewControllerd = storyboard.instantiateViewControllerWithIdentifier("a") as? SecondViewController
viewControllerd = SecondViewController.init(title: "helo")
addViewControllerAsChildViewController(viewControllerd!)
第二视图控制器
init(title : String)
{
a = title
super.init(nibName: "SecondViewController", bundle: nil)
}
required init(coder aDecoder: NSCoder)
{
super.init(coder: aDecoder)!
}
【问题讨论】:
-
请显示崩溃日志。
标签: ios iphone swift uistoryboardsegue