ちなみに、今回はUITabBarController>UIWebViewなアプリケーションの場合です。
AppDelegate.m
// 回転時に呼ばれる
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
NSString *className = NSStringFromClass([window class]);
// ネストしているViewがMPFullscreenWindowやMPInlineVideoFullscreenViewControllerである場合があるので確認する
if ([((UITabBarController *)window.rootViewController) respondsToSelector:@selector(presentedViewController)]) {
className = NSStringFromClass([((UITabBarController *)window.rootViewController).presentedViewController class]);
}
// MP*FullscreenWindowなどがYouTube再生時のViewの名称なので
// そのときは全部の回転を許可する
if ([className isEqualToString:@"MPFullscreenWindow"] || [className isEqualToString:@"MPInlineVideoFullscreenViewController"]) {
return UIInterfaceOrientationMaskAll;
} else {
return UIInterfaceOrientationMaskPortrait;
}
}
参考:
http://stackoverflow.com/questions/22095982/how-to-rotate-a-video-embed-in-uiwebview-for-ios-7-only