我开发了一个iOS应用程序并在iOS6设备上进行了测试。在测试过程中,我意识到我的应用程序没有按预期响应方向更改。如何在iOS 6中以编程方式获取设备的当前方向?
这里是我的代码:
// Autorotation (iOS >= 6.0)
- (BOOL) shouldAutorotate
{
return NO;
}
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskAll;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationMaskPortrait;
}
准确地说,我想知道,什么方法都要求在iOS的取向的变化。
“我的代码是不工作就定位”意味着? –
其实我想知道当我旋转我的设备时调用哪个方法..? –
它将调用shouldAutorotate方法并支持界面方向方法 –