1

我在 ios6 中支持横向和纵向模式。我也尝试使用新的设备旋转方法,但是没有调用这些方法并且它不支持方向。

我的代码如下:

-(NSUInteger)supportedInterfaceOrientations
{
    NSLog(@"supportedInterfaceOrientations...");
    return UIInterfaceOrientationMaskAll;
}

-(BOOL)shouldAutorotate
{
    NSLog(@"shouldAutoRotate...");
    return YES;
}

我不知道这个问题。

谢谢...

4

2 回答 2

0

是否分别支持 Target 中的所有 Interface OrientationsInfo.plist

支持的接口方向 您需要检查所有这些图像以支持所有Orientations

于 2012-12-28T10:42:57.320 回答
0

试试这个,

因为您提到:部署目标是 ios5,但您在 ios6 中运行应用程序。

在 .pch 文件中,

#define IOS_OLDER_THAN_6 ( [ [ [ UIDevice currentDevice ] systemVersion ] floatValue ] < 6.0 )

#define IOS_NEWER_OR_EQUAL_TO_6 ( [ [ [ UIDevice currentDevice ] systemVersion ] floatValue ] >= 6.0 )

在控制器文件中,检查条件,

#ifdef IOS_OLDER_THAN_6
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
     return toInterfaceOrientation;
}
#endif

#ifdef IOS_NEWER_OR_EQUAL_TO_6
-(BOOL)shouldAutorotate {
     return YES;
}

- (NSUInteger)supportedInterfaceOrientations {
     return (UIInterfaceOrientationMaskAll);
}
#endif

希望对您有所帮助。谢谢。

于 2012-12-28T12:18:01.193 回答