我编写了一个带有一些视图控制器的选项卡式应用程序,并且在iOS 6上,它在所有方向上都可以愉快地旋转,因为我在应用程序摘要中都对它们进行了支持。

但是,我的部署目标是iOS 5,我也希望能够在所有方向上旋转。我尝试了以下各种组合:

- (NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationPortrait | UIInterfaceOrientationLandscape;
}

但是,没有一个能够为iOS 5启用旋转功能。我是否需要将此方法仅放在应用程序委托中或所有视图控制器中?我做错了吗?

干杯,

克里斯

最佳答案

您可以将其添加到所有视图控制器中

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    return (interfaceOrientation == UIInterfaceOrientationPortrait) || (interfaceOrientation == UIInterfaceOrientationLandscape);
}

或者您可以编辑您的列表的Supported Interface orientations

关于iphone - iOS对所有方向启用旋转iOS 5,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/14899607/

10-12 00:15
查看更多