如何转换类类型?

时间:2016-09-05 10:31:17

标签: ios swift nscoder sktransition

我正在试图弄清楚如何转换类类型,以便我可以从我的SKScene(自我)转到我的SCNScene即GamePlay。并且基本上执行场景正常场景转换。

enter image description here 代码:

let scene = GamePlay(coder:NSCoder())
let transition = SKTransition.crossFadeWithDuration(1)
view?.presentScene(scene, transition: transition)

1 个答案:

答案 0 :(得分:0)

尝试将scene投射到SKScene

 let scene = GamePlay(coder:NSCoder())
 let transition = SKTransition.crossFadeWithDuration(1)
 if let skScene = scene as? SKScene {
        view?.presentScene(skScene, transition: transition)
 }