webView 嵌套视频横屏 app不支持横屏,iOS 8以上

func application(application: UIApplication, supportedInterfaceOrientationsForWindow window: UIWindow?) -> UIInterfaceOrientationMask {
        
        if var presentedViewController = window?.rootViewController?.presentedViewController {
            while (presentedViewController.presentedViewController) != nil {
                presentedViewController = presentedViewController.presentedViewController!
            }
            
            if let objClass = NSClassFromString("AVFullScreenViewController") where presentedViewController.isKindOfClass(objClass) && !presentedViewController.isBeingDismissed() {
                return UIInterfaceOrientationMask.AllButUpsideDown
            }
            
            if presentedViewController.isKindOfClass(MPMoviePlayerController) && !presentedViewController.isBeingDismissed() {
                return UIInterfaceOrientationMask.AllButUpsideDown
            }
        }
      //判断iPad 需要可以旋转
        if UIDevice.currentDevice().model.hasPrefix("iPad") {
            if UIDevice.currentDevice().orientation.rawValue == 2 {
                return UIInterfaceOrientationMask.PortraitUpsideDown
            }
        }
        return UIInterfaceOrientationMask.Portrait
    }

假如你是用 MPMoviePlayerController 需要 import MediaPlayer

你可能感兴趣的:(webView 嵌套视频横屏 app不支持横屏,iOS 8以上)