I started my projects as a Spritekit game. Put a button on top of my defaultviewcontroller in storyboard. Presented a scene in viewwilllayoutsubviews.
if let scene = GameScene.unarchiveFromFile("GameScene") as? GameScene {
// Configure the view.
let skView = self.view as! SKView
self.skView = skView
skView.showsFPS = true
skView.showsNodeCount = true
/* Sprite Kit applies additional optimizations to improve rendering performance */
skView.ignoresSiblingOrder = true
/* Set the scale mode to scale to fit the window */
scene.scaleMode = SKSceneScaleMode.AspectFill
println("Width: \(scene.frame.width) andHEight: \(scene.frame.height)")
scene.gameSceneDelegate = self
sceneStack.append(scene)
skView.presentScene(scene)
}
After some time I transitioned to a new scene through viewcontroller code:
skView.presentScene(scene, transition: transition)
Now the scene changes but the button I had put on view storyboard stays there.. on top of the scene. Now On pressing the button I change the image of button... This surprisingly results in the scene changing back to the previous scene. As a result on changing the buttons any property it results in poping of my new scene and reverts back to the scene I presented initially.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire