【问题标题】:Cannot find (secondary) storyboard named Test.storyboard找不到名为 Test.storyboard 的(辅助)故事板
【发布时间】:2016-09-27 16:25:23
【问题描述】:

我想在我的应用中加载第二个故事板Test.storyboard(在Main.storyboard 旁边),如下所示:

let storyboard = UIStoryboard(name: "Test.storyboard", bundle: nil)

Test.storyboard 位于组 Test 中,它被标记为本地化为 Base(因此其相对于组的位置报告为 Base.lproj/Test.storyboard),并且它还在我的应用程序目标中标记为目标成员。当我在模拟器上运行应用程序时,我可以确认应用程序的主包中存在 Base.lproj/Test.storyboardc 文件。

然而上面的代码产生了这个错误:

Could not find a storyboard named 'Test.storyboard' in bundle ...

成功打包和加载像我这样的二级故事板的正确方法是什么?

【问题讨论】:

标签: ios swift storyboard ios10


【解决方案1】:

您不需要像这样加载带有 .storyboard 扩展名的故事板 .use

   let storyboard = UIStoryboard(name: "Test", bundle: nil)

【讨论】:

    猜你喜欢
    • 2017-05-18
    • 1970-01-01
    • 2012-01-31
    • 2015-04-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-09-14
    • 1970-01-01
    相关资源
    最近更新 更多