supportedInterfaceOrientations - 支持iOS6和iOS5

3

只有一个快速的问题。假设我把我的应用更新到了iOS6,并将iOS5中的shouldAutoRotate方法更改如下:

- (BOOL) shouldAutorotate
{
return YES;
}

-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscapeRight;
}

如果我仍在支持iOS5,那么我需要检查iOS版本,并在设备运行iOS5时同时包含旧的iOS5方法(例如shouldAutoRotateToInterfaceOrientation)吗?
谢谢!
1个回答

5

在你的应用程序中同时具备 iOS5 和 iOS6 代码是可以的。

在 iOS5 上,supportedInterfaceOrientations 和 shouldAutorotate 方法不会被调用,而在 iOS6 上,旧的方法 shouldRotateToInterfaceOrientation 等也不会被调用。


非常好 - 谢谢。我想知道在编译时,旧的iOS5版本是否最终会被标记为弃用。 - GuybrushThreepwood
我预计这将在iOS7左右发生。 - Ben Clayton

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接