swift - 没有从 GameViewController 菜单移动到 GameScene Swift

标签 swift xcode sprite-kit skscene

我在 GameViewController 中制作了游戏菜单。然后,当按下 Go 按钮时,我尝试移动到 GameScene。我使用默认代码来呈现 GameScene 文件。

 if let scene = GameScene(fileNamed:"GameScene") {

         // Configure the view.
         let skView = self.view as! SKView
         skView.showsFPS = false
         skView.showsNodeCount = false

         /* Sprite Kit applies additional optimizations to improve rendering performance */
         skView.ignoresSiblingOrder = true

         /* Set the scale mode to scale to fit the window */
         scene.scaleMode = .AspectFill

         skView.presentScene(scene)
}

我在 Storyboard中制作了菜单。我认为这就是它不起作用的原因。我该如何解决这个问题?

尼尔

最佳答案

在SpriteKit中我们使用场景,GameScene位于上面的GameViewController中。 GameViewController 向您显示 GameScene。

关于swift - 没有从 GameViewController 菜单移动到 GameScene Swift,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39560878/

相关文章:

ios - 如何从 ViewController 转移(推送)到另一个嵌入在 NavigationController 中的 ViewController?

ios - Autolayout - 在模拟器中运行时文本字段垂直拉伸(stretch)

swift - @objc'只能应用于类的扩展,从swift调用扩展方法到objective c

ios - 由于关闭而导致对开始/结束外观转换的不平衡调用 - 不涉及任何转换或转场

ios - 如何将视频保存在 url 的目录中?

Xcode 4 文件完整路径

ios - 使用 Swift 在 SpriteKit 中复制()节点

swift - 使用 GKPolygonObstacle 创建障碍物

ios - 如何使用 SpriteKit 以编程方式快速更改背景颜色

ios - MKMapSnapshotOptions : Adding snapshot of Custom Pin Annotation View or UIView