【发布时间】:2016-06-02 14:30:54
【问题描述】:
我创建了一个动态框架(需要是动态的,因为它包含 .swift 文件),该框架工作正常,我可以像这样从 appDelegate 以编程方式加载我的故事板:
let frameworkBundle = NSBundle(identifier: "DynamicLibrary")
let s = UIStoryboard(name: "MainStoryboardName", bundle: frameworkBundle)
// Override point for customization after application launch.
self.window = UIWindow(frame: UIScreen.mainScreen().bounds)
// Override point for customization after application launch.
self.window!.backgroundColor = UIColor.whiteColor()
self.window!.makeKeyAndVisible()
self.window!.rootViewController = s.instantiateInitialViewController()
但是当我更改 ViewController(移动到同一个 .storyboard 内的另一个屏幕)时,应用程序崩溃了。 我想知道是否可以将动态框架中的 .storyboard 作为主界面包含在项目设置中。或者从动态框架加载 .storyboard 作为主故事板的最佳替代方法是什么。
【问题讨论】:
标签: ios iphone xcode cocoa-touch