0

我不知道为什么设备方向不起作用。

在项目属性中:

在此处输入图像描述

在我的代码中,我有:

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

我在我的iphone中探测它并且没有改变。

有什么遗漏吗?

先感谢您

已编辑(info.plist)

在此处输入图像描述

4

3 回答 3

0

您的代码在哪里shouldAutorotateToInterfaceOrientation:实现?它应该是每个子类的方法UIViewController

尝试通过在shouldAutorotateToInterfaceOrientation:. 如果它没有被调用,其他地方的视图控制器正在为你决定你的有效方向。

于 2012-08-28T06:21:14.753 回答
0

打开您的info.plist文件XCode并添加一行 -Supported interface orientation类型数组。

点击它旁边的加号按钮并列出您要使用的所有方向。iPhone您可以为和设置不同的设置iPad

于 2012-08-27T15:05:46.390 回答
0
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if((interfaceOrientation == UIInterfaceOrientationPortrait) ||
   (interfaceOrientation == UIInterfaceOrientationLandscapeLeft)||
   (interfaceOrientation == UIInterfaceOrientationLandscapeRight))
{
    return YES;
}

return NO;

}
于 2012-08-27T21:05:04.230 回答