Showing the Star Field Underneath UIKit

Our menu is done, but it’s bland. It would be nice if we could play some animations from our game underneath the menu, like our star field. Well, with Sprite Kit, we can!

All of the Sprite Kit magic in an SKScene object gets rendered in a special UIView subclass called an SKView. Because it’s a member of the view hierarchy, we can put an SKView anywhere we want on any iOS interface. Note that normal controls and views cannot interact directly with Sprite Kit nodes because nodes exist entirely within the Sprite Kit world. Also, Sprite Kit views are always opaque, so you can’t overlay nodes on top of a standard user interface. But still, this gives us a lot of power to use Sprite Kit for visualizations ...

Get Build iOS Games with Sprite Kit now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.