Locking the Game to Portrait and Removing the Status Bar

As you know, this is a book about Sprite Kit. We’ve talked about UIKit out of necessity to integrate with the rest of Apple’s ecosystem for iOS applications. Before we can wrap up our discussion of the pinball game, we should make two minor changes to the app to get it ready for players.

First, the pinball game should not allow auto-rotation to landscape mode. It’s meant to be played in portrait. But if the device is rotated while playing, the game will also rotate with it and look weird because of the way the scene scales to fill the width. It scales up because the scene’s scaleMode property is set to SKSceneScaleModeAspectFill in the RCWViewController.m file by default. The scaling ...

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.