找不到名为 Test.storyboard 的(次要)故事板
Cannot find (secondary) storyboard named Test.storyboard
我想像这样在我的应用中加载辅助故事板 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 ...
成功打包和加载像我这样的二级故事板的正确方法是什么?
您不需要加载带有 .storyboard 扩展名的故事板。像这样使用
let storyboard = UIStoryboard(name: "Test", bundle: nil)
我想像这样在我的应用中加载辅助故事板 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 ...
成功打包和加载像我这样的二级故事板的正确方法是什么?
您不需要加载带有 .storyboard 扩展名的故事板。像这样使用
let storyboard = UIStoryboard(name: "Test", bundle: nil)