portedInterfaceOrientations方法不适用

portedInterfaceOrientations方法不适用

本文介绍了supportedInterfaceOrientations方法不适用于iOS 6 UIViewController的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

iOS 5 中,我的应用程序使用该方法更改了我的方向:

In iOS 5, my application I used the method to change my orientation:

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

iOS 6 我认为我应该要做到这一点,但它什么都不做!我的应用程序不是按照我希望的方式轮换。

In iOS 6 I think I'm supposed to do this, but it does nothing! My app is rotated not the way I want it to be.

- (BOOL) shouldAutorotate
{
    return YES;
}

-(NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskLandscapeRight;
}


推荐答案

这就是我添加我的方式的viewController

It's how I was adding my viewController.

我替换了这行代码:

[window addSubview:viewController.view];

此行:

[window setRootViewController:viewController];

这篇关于supportedInterfaceOrientations方法不适用于iOS 6 UIViewController的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 15:39