我有一个ios6的应用程序。如果该应用程序在手机上运行,我希望只支持纵向。如果在平板电脑上,我希望支持所有方向。我以为这样就行了(在我的视图控制器中):
- (NSUInteger)supportedInterfaceOrientations
{
if ([Util isPhoneFormFactor]) {
return UIInterfaceOrientationPortrait;
}
return UIInterfaceOrientationMaskAll;
}但这在我的iphone模拟器上启动时抛出了一个异常:
*** Terminating app due to uncaught exception
'UIApplicationInvalidInterfaceOrientation', reason:
'Supported orientations has no common orientation with
the application, and shouldAutorotate is returning YES'我将其解释为必须覆盖以下代码并返回NO:
- (BOOL) shouldAutorotate
{
return NO;
}这解决了这个问题,但当在ipad模拟器上旋转时,我不再获得旋转。这样做的正确方法是什么?
谢谢
发布于 2013-01-04 14:36:26
你说的是UIInterfaceOrientationPortrait但你指的是UIInterfaceOrientationMaskPortrait。你遗漏了Mask。
https://stackoverflow.com/questions/14152266
复制相似问题