简体   繁体   English

旋转在iOS5故事板中不起作用

[英]Rotation isn't working in iOS5 Storyboard

I'm working on a storyboard app and the rotation works on iOS6 devices but when I run it on my iOS5 device it won't rotate. 我正在使用情节提要应用程序,并且轮换可以在iOS6设备上使用,但是当我在iOS5设备上运行时,它不会旋转。 I have a View Controller embedded in a Navigation Controller (so the Navigation Controller is the root view controller of the window) and I have the following methods overridden: 我在导航控制器中嵌入了一个视图控制器(因此,导航控制器是窗口的根视图控制器),并且重写了以下方法:

- (BOOL)shouldAutorotate
{
    return YES;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    return UIInterfaceOrientationLandscapeRight;
}

- (NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskLandscapeRight|UIInterfaceOrientationMaskLandscapeLeft|UIInterfaceOrientationMaskPortrait;
}


-(BOOL)shouldAutoRotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{

     if ((interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (interfaceOrientation == UIInterfaceOrientationLandscapeRight) || (interfaceOrientation ==UIInterfaceOrientationPortrait)){
        return YES;
     } else {
         return NO;
     }
}

I also have the 3 orientations allowed in my plist, and my deployment target is iOS5 with the base SDK iOS6 and autolayout is turned off, and ideas why this isnt working? 我在plist中也允许3种方向,我的部署目标是使用基本SDK iOS6的iOS5,并且自动布局已关闭,为什么这种方法不起作用?

Thank you! 谢谢!

Your comment caused me to look closer. 您的评论使我更加接近。 It's because you have a capital 'R' in autorotation. 这是因为您在自动旋转中使用大写字母“ R”。

Change your method name to: shouldAutorotateToInterfaceOrientation: 将您的方法名称更改为: shouldAutorotateToInterfaceOrientation:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM