【发布时间】:2023-03-19 11:10:02
【问题描述】:
我意识到这是一个非常常见的问题,但我找到的解决方案都没有解决我的问题。
要解决 Game Center 在横向启动时的崩溃问题,您必须为所有方向添加支持的界面方向(我已经这样做了)。 iPhone/iPod 上的崩溃问题现已针对这些特定设备解决。
现在,我遇到的问题是 iPad 1 特有的。如果您在游戏启动时将 iPad 置于纵向模式,则游戏可以保持纵向,直到您旋转设备(如果您尝试将其旋转回来,它不会,只有在 STARTUP 时才会出现此问题)。除非我从支持的界面方向中删除纵向。不幸的是,如果我这样做,应用程序将在其他设备上崩溃。
我的初始界面方向是横向左。
这是我目前拥有的代码:
(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
return (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft || toInterfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscapeRight|UIInterfaceOrientationMaskLandscapeLeft;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationLandscapeRight;
}
- (BOOL)shouldAutorotate{
return YES;
}
【问题讨论】:
-
这行不通,如果我这样做,它会在 ipods/iphone 上崩溃。
标签: objective-c xcode ipad ios6 ios5.1