Translate

2015年7月31日 星期五

播放影片可以直向橫向

參考[iOS] 在WebView播放Youtube影片旋轉 - (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window { if ([[window.rootViewController presentedViewController] isKindOfClass:[MPMoviePlayerViewController class]] || [[window.rootViewController presentedViewController] isKindOfClass:NSClassFromString(@"XCDYouTubeVideoPlayerViewController")] || [[window.rootViewController presentedViewController] isKindOfClass:NSClassFromString(@"XCDYouTubeVideoPlayerViewController")]) { return UIInterfaceOrientationMaskAll; } else { if ([[window.rootViewController presentedViewController] isKindOfClass:[UINavigationController class]]) { // look for it inside UINavigationController UINavigationController *nc = (UINavigationController *)[window.rootViewController presentedViewController]; // is at the top? if ([nc.topViewController isKindOfClass:[MPMoviePlayerViewController class]]) { return UIInterfaceOrientationMaskAll; // or it's presented from the top? } else if ([[nc.topViewController presentedViewController] isKindOfClass:[MPMoviePlayerViewController class]]) { return UIInterfaceOrientationMaskAll; } } } return UIInterfaceOrientationMaskPortrait; }

沒有留言:

張貼留言