如何从webview播放video时设置横向方向

我有一个video链接的网页视图,该应用程序只是纵向,但我需要改变方向时,全屏video,并使用所有的屏幕。 谢谢你的帮助。

把它放在你的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上testing过,但是在iOS8下运行良好

除了iOS 7和iOS 8的这个答案之外

放入AppDelegate。 适用于iOS 7和iOS 8:

 - (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window { id presentedViewController = [window.rootViewController presentedViewController]; NSString *className = presentedViewController ? NSStringFromClass([presentedViewController class]) : nil; if (window && ([className isEqualToString:@"MPInlineVideoFullscreenViewController"] || [className isEqualToString:@"AVFullScreenViewController"])) { return UIInterfaceOrientationMaskAll; } else { return UIInterfaceOrientationMaskPortrait; } } 
    Interesting Posts