我有一个正在制作的应用程序,我需要从我的单 View 应用程序 View 转换到 GameScene。我将 GameViewController.swift、GameScene.swift 和 GameScene.sks 添加到我的项目中。如何从我的 View Controller 转到我的 GameScene?我查看了示例,但没有一个有帮助,任何快速解决方案都很好。
这是我用来进入我的游戏的代码。
let storyboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let gameView: UINavigationController = storyboard.instantiateViewController(withIdentifier: "miniGame") as! UINavigationController
self.present(gameView, animated: true, completion: nil)
但是我得到一个错误
Could not cast value of type 'UIView' (0x2d73b00) to 'SKView' (0x1ba878c).
(数据库)
它在我的 GameViewController 中的这行代码中弹出错误
if let view = self.view as! SKView? {
最佳答案
关于ios - 如何从单一 View 转到 spritekit,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41008185/