supportedInterfaceOrientations 方法不适用于 iOS 6 UIViewController [英] supportedInterfaceOrientations method not working on iOS 6 UIViewController
本文介绍了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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文