首页 文章

iOS SpriteKit:如何强制纵向模式?

提问于
浏览
4

我目前正在开发适用于iOS 7和XCode 6的SpriteKit游戏 . 游戏应始终以纵向模式呈现 . 到目前为止,我已在视图控制器中实现了这些方法:

- (BOOL)shouldAutorotate {
    return NO;
}

- (NSUInteger)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskPortrait;
}

只要我启动应用程序将我的iPad保持在纵向模式,这样就可以正常工作 . 在游戏过程中它不会切换方向 .

但是,在应用程序启动期间以横向方向按住iPad时,游戏会以横向显示 .

即使在启动期间设备以横向模式保持,如何强制应用程序以纵向模式显示?

1 回答

  • 12

    解决应用方向问题

    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
    

相关问题