切换ViewController场景

时间:2016-11-23 01:56:12

标签: ios swift

我尝试在SKScene上按下按钮后呈现ViewController。我怎样才能做到这一点?

override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
        let touch = touches.first
        if let location = touch?.location(in: self) {
            let node = self.nodes(at: location)

            if node[0].name == "newGameButton" {
                let transition = SKTransition.flipHorizontal(withDuration: 0.5)
                let gameScene = GameScene(size: self.size)

                self.view!.presentScene(QuestionViewController, transition: transition)

          }
      }

0 个答案:

没有答案