salocinx
salocinx

Reputation: 3823

iOS+SpriteKit: How to force portrait mode?

I'm currently working on a SpriteKit game for iOS 7+ and XCode 6. The game should always be presented in portrait mode. So far I have implemented these methods in my view controller:

- (BOOL)shouldAutorotate {
    return NO;
}

- (NSUInteger)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskPortrait;
}

This works fine as long as I start the app holding my iPad in portrait mode. It does not switch the orientation during game play.

But when holding the iPad in landscape orientation during the app is starting, the game is shown in landscape.

How do I force the app to be shown in portrait mode even if the device was held in landscape mode during startup ?

Upvotes: 4

Views: 1467

Answers (1)

Harish
Harish

Reputation: 609

To solve the app orientation issue

Go to your projects plist file (should be "YourApp-Info.plist")
Add a row and enter "Supported interface orientations"
Add the orientations that your app supports 

Upvotes: 12

Related Questions