0

自动旋转在 ios6.1 中不起作用。但以下代码在其他应用程序中工作。

代码:

@implementation UINavigationController (RotationIn_IOS6)

-(BOOL)shouldAutorotate
{
    return [[self.viewControllers lastObject] shouldAutorotate];
}

-(NSUInteger)supportedInterfaceOrientations
{
    return [[self.viewControllers lastObject] supportedInterfaceOrientations];
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    return [[self.viewControllers lastObject]  preferredInterfaceOrientationForPresentation];
}

@end


- (BOOL)shouldAutorotate
{
    //returns true if want to allow orientation change
    return TRUE;


}
- (NSUInteger)supportedInterfaceOrientations
{
    //decide number of origination tob supported by Viewcontroller.
    return UIInterfaceOrientationMaskAll;


}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    //from here you Should try to Preferred orientation for ViewController

    return UIInterfaceOrientationLandscapeLeft | UIInterfaceOrientationLandscapeRight | UIInterfaceOrientationPortrait;
}

- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)  interfaceOrientation duration:(NSTimeInterval)duration
{

}
4

3 回答 3

1

ios6 主要使用 plist 选项进行自动旋转。尝试设置支持的方向字段。

于 2013-04-08T08:23:04.070 回答
0

请检查您的项目目标夏季如下

在此处输入图像描述

于 2013-04-09T09:02:36.550 回答
0

您是否尝试过修改 plist?

于 2013-04-08T07:45:10.943 回答