我一直在寻找过去几天的解决方案,以仅在MPMoviePlayerViewController被触发旋转,没有任何的运气。 我试图启用应用程序的所有旋转,并在每个视图禁用它,但它也没有工作。如何启用旋转仅在视频
没有任何一个有想法?
我一直在寻找过去几天的解决方案,以仅在MPMoviePlayerViewController被触发旋转,没有任何的运气。 我试图启用应用程序的所有旋转,并在每个视图禁用它,但它也没有工作。如何启用旋转仅在视频
没有任何一个有想法?
(可选,UIViewController中默认只有纵向)在所有其它视图控制器,执行以下操作:
// Deprecated in iOS 6, but still needed for earlier versions of iOS:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
// For iOS 6 and up
- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskPortrait;
}
在应该旋转一个视图控制器,执行以下操作:
// Deprecated in iOS 6, but still needed for earlier versions of iOS:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return YES;
}
// For iOS 6 and up
- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskAll;
}
这是假定旋转视图控制器不会位于同一个容器视图控制器(如UINavigationController
或UITabBarController
)内作为非旋转视图控制器。
创建播放器全屏新ViewController
并添加:
- (BOOL)shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
你的代码。
确保你目前的ViewController
。 (支持iOS 6以上)
我使用的UINavigationController,试图继承它,并花费上面的方法,没有运气... – AndroAid
所以,最终我花费的UINavigationController的和的UITabBarController,实现了上面的方法,它的工作原理!非常感谢!!!!!! – AndroAid