多个UIInterfaceOrientations应用程序与iOS 6
我正在尝试从iOS 6设置新的UIInterfaceOrientations。
恢复我的应用程序:
- 我的应用程序有一堆意见;
- 几乎每个视图都应该在纵向上显示;
- 我的2个视图(用
MPMoviePlayerViewController
播放video的MPMoviePlayerViewController
)应该旋转到左,右和纵向。
我最初的想法是将应用程序支持的方向设置为肖像,而不是从video播放器视图中更改(不知道如何)支持的方向。
什么是处理这个问题的最好方法?
先谢谢你!
通过设置所需支持的界面方向(纵向,横向左右)和添加一个Category
的UINavigationController
。
我添加了类别的任何UINavigationController
我想留在肖像模式和处理iOS 6旋转像这个职位 :
@implementation UINavigationController (Rotation_IOS6) -(BOOL)shouldAutorotate { return NO; } -(NSUInteger)supportedInterfaceOrientations { return UIInterfaceOrientationPortrait; } - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation { return UIInterfaceOrientationPortrait; } @end
有了这个实现,我仍然有一些问题,因为代码是这样的:
[self.window.rootViewController presentModalViewController:controller animated:NO];
而不是这个:
[self.navigationController pushViewController:controller animated:NO];
通过上述更改,我可以将整个应用程序保留在纵向模式下,并让video播放器查看继续旋转,因为它们的方法(shouldRotate和supportedInterfaceOrientations)不会被覆盖。
看看我的post: https : //stackoverflow.com/a/12538622/1575017这是同样的事情,但翻转方向为你。