无法过渡
Cannot transition
所以,我一直在玩弄 Sprite Kit 和 Swift 东西,当我遇到问题时,我试图在游戏场景和常规 UIVewController 之间进行转换。当实际程序为 运行 时,它 returns 出错。这是我的代码:
var mainStoryboard = UIStoryboard(name: "Main.storyboard", bundle: nil)
var vc = mainStoryboard.instantiateViewControllerWithIdentifier("menu") as! UIViewController
self.view!.window?.rootViewController?.presentViewController(vc, animated: true, completion: nil)
这里是错误:
Could not find a storyboard named 'Main.storyboard' in bundle NSBundle //bundle location here... (irrelevant)
有人知道为什么这不起作用吗?当我查看屏幕左侧的视图时,我看到故事板文件的名称是 "Main.storyboard"。我是不是做错了什么?
感谢任何帮助!提前致谢!
故事板的名称只是 "Main"
而不是 "Main.storyboard"
。
来自 documentation:
The name of the storyboard resource file without the filename extension. This method raises an exception if this parameter is nil.
所以,我一直在玩弄 Sprite Kit 和 Swift 东西,当我遇到问题时,我试图在游戏场景和常规 UIVewController 之间进行转换。当实际程序为 运行 时,它 returns 出错。这是我的代码:
var mainStoryboard = UIStoryboard(name: "Main.storyboard", bundle: nil)
var vc = mainStoryboard.instantiateViewControllerWithIdentifier("menu") as! UIViewController
self.view!.window?.rootViewController?.presentViewController(vc, animated: true, completion: nil)
这里是错误:
Could not find a storyboard named 'Main.storyboard' in bundle NSBundle //bundle location here... (irrelevant)
有人知道为什么这不起作用吗?当我查看屏幕左侧的视图时,我看到故事板文件的名称是 "Main.storyboard"。我是不是做错了什么?
感谢任何帮助!提前致谢!
故事板的名称只是 "Main"
而不是 "Main.storyboard"
。
来自 documentation:
The name of the storyboard resource file without the filename extension. This method raises an exception if this parameter is nil.