supportedInterfaceOrientations - 支持iOS6和iOS5

Guy*_*ood 3 iphone rotation ipad ios5 ios6

只是一个简单的问题.假设我已将我的应用更新到iOS6并更改了iOS5的shouldAutoRotate方法,如下所示:

- (BOOL) shouldAutorotate
{
return YES;
}

-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscapeRight;
}
Run Code Online (Sandbox Code Playgroud)

如果我仍然支持iOS5,我是否需要检查iOS版本,然后还要包含旧的iOS5方法(即shouldAutoRotateToInterfaceOrientation),如果应用程序是在运行iOS5的设备上运行的话?

谢谢 !

Ben*_*ton 5

在你的应用程序中同时拥有iOS5和iOS6代码是可以的.

在iOS5上,不会调用supportedInterfaceOrientations和shouldAutorotate,而在iOS6上将不会调用旧方法shouldRotateToInterfaceOrientation等.