webView 嵌套视频横屏 app不支持横屏,iOS 8以上
2017-02-28 本文已影响462人
Jniying
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
}