我有一个支持所有设备方向的主ViewController以及仅支持横向的视频播放器ViewController。支持所有方向的iOS ViewController在从横向返回后更改为横向ViewController
当设备的方向被解锁,并且我从视频返回到主ViewController时,它仍然根据我的设备的方向自动旋转。这是所需的行为。
但是,当设备的方向被锁定,并且我从纵向模式主视图控制器开始时,我从横向视频返回,现在主视图控制器被锁定到横向模式。这只发生在iOS 9+上。
我不确定它是相关的,但主ViewController继承Cordova的CDVViewController。这里是来自VideoPlayerViewController的方向相关的代码:
- (BOOL)shouldAutorotate{
return YES;
}
- (NSInteger)supportedInterfaceOrientations{
return UIInterfaceOrientationMaskLandscape;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation{
return UIInterfaceOrientationLandscapeLeft;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft ||
interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
我很感激任何想法如何解决这个问题。谢谢!
如何呈现视频视图...推送到UINavigationController或作为模态视图控制器? – Ladislav