IOS6 landscape playing embedded youtube video from a uiwebview within an only portrait iPhone app

前端 未结 2 573
梦谈多话
梦谈多话 2021-02-08 23:18

I\'ve got an iPhone application with a storyboard,few xib and custom cells.

The application is set as a \"portrait\" as \"supported interface orientation\" (i mean every

2条回答
  •  抹茶落季
    2021-02-08 23:45

    I took Almas Adilbek's answer (very nicely done!) and boiled it down to its essential component. Just this code alone (added to my app delegate) seems to be getting the desired results for me. Will update if I run into any issues.

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

提交回复
热议问题