Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between SKView and SKScene

From the Apple Docs..

SKView: "An SKView object is a view that displays Sprite Kit content. This content is provided by an SKScene object."

SKSCene: "An SKScene object represents a scene of content in Sprite Kit."

What's the difference? Is an SKScene similar to a view controller and an SKView like a UIView?

like image 408
Ivan Lesko Avatar asked Feb 22 '14 05:02

Ivan Lesko


1 Answers

The SKView is a UIView subclass. It wraps up Sprite Kit content in a view that can be used like any other Cocoa view. It usually has an associated view controller. That's Sprite Kit's connection with the Cocoa world.

The scene is the root object of the scene graph. It provides callbacks (physics, scene change, update) needed to implement a game. It does not concern itself with anything Cocoa related.

Normally the view remains as is while you can present scenes to swap out game content, for example moving from the menu to the game scene. Internally the view also caches resource files in memory, so as you switch scenes they don't have to reload the same textures.

like image 82
LearnCocos2D Avatar answered Oct 09 '22 22:10

LearnCocos2D