从Webview播放视频时如何设置横向 [英] how can i set landscape orientation when playing a video from webview
本文介绍了从Webview播放视频时如何设置横向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个带视频链接的网络视图,该应用程序仅是纵向的,但是当视频在全屏模式下使用所有屏幕时,我需要更改方向. 感谢您的帮助.
i have a webview with a video link, the app is only portrait orientation but i need to change orientation when the video is in fullscreen and use all screen. Thanks for your help.
推荐答案
将其放入您的AppDelegate
:
- (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
id presentedViewController = [window.rootViewController presentedViewController];
NSString *className = presentedViewController ? NSStringFromClass([presentedViewController class]) : nil;
if (window && [className isEqualToString:@"AVFullScreenViewController"]) {
return UIInterfaceOrientationMaskAll;
} else {
return UIInterfaceOrientationMaskPortrait;
}
}
注意:我没有 在iOS7上进行过测试,但在iOS8上运行良好
Note: I have not tested this with iOS7 but works well with iOS8
这篇关于从Webview播放视频时如何设置横向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文