O'Reilly logo

iOS® 8 for Programmers: An App-Driven Approach with Swift™, Third Edition by Abbey Deitel, Harvey M. Deitel, Paul J. Deitel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

6.9.3 Overridden SKScene Method didMoveToView

When an SKScene is presented, its didMoveToView method (Fig. 6.20) is called to enable you to configure the scene. The method receives as an argument a reference to the SKView that presented the scene—the view in the GameViewController that Xcode created for you when you used the Game app template to create this app. Line 30 sets the scene’s background color to white.

  28       // called when scene is presented  29       override func didMoveToView(view: SKView) {  30           self.backgroundColor = SKColor.whiteColor() // set background  31   32           // helps determine game element speeds based on scene size  33           var velocityMultiplier = self.size.width ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required