【发布时间】:2012-12-12 09:26:23
【问题描述】:
我开发了一个 iOS 应用并在 iOS6 设备上进行了测试。在测试时,我意识到我的应用没有像预期的那样响应方向变化。
这是我的代码:
// Autorotation (iOS >= 6.0)
- (BOOL) shouldAutorotate
{
return NO;
}
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskAll;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationMaskPortrait;
}
确切地说,我想知道在 iOS 中,Orientation Changes 调用了哪些方法。
【问题讨论】:
-
"我的代码在方向上不起作用。"是什么意思?
-
其实我想知道当我旋转我的设备时调用了哪个方法..?
-
它会调用 shouldAutorotate 方法和支持的界面定位方法
-
@MidhunMP 此方法在 iOS 6 中已弃用...这就是原因。
-
那是个误会,引入了
shouldAutoRotate方法,而不是shouldAutorotateToInterfaceOrientation。并且可以在iOS5和iOS 6中使用
标签: iphone ios6 screen-orientation device-orientation ipad-3