MPMoviewPlayerController fullscreen playback rotation with underlying UIViewController with portrait mode only (rotation disallowed)

前端 未结 5 567
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-05 01:35

Hallo,

I have a simple application, which does contain UITabBarController with two UIViewControllers. Both UIViewControllers are portrait only (no rotation allowed).

5条回答
  •  心在旅途
    2020-12-05 02:02

    Register for MPMoviePlayerWillExitFullscreenNotification and MPMoviePlayerWillEnterFullscreenNotification in app delegate and handle the orientation using an instance variable.

    
    -(void)moviePlayerFullScreen:(NSNotification *)notification
    {
        if ([notification.name isEqualToString:@"MPMoviePlayerWillEnterFullscreenNotification"]) {
    
            self.supportedOrientation=UIInterfaceOrientationMaskAll;
    
        }
        else if ([notification.name isEqualToString:@"MPMoviePlayerWillExitFullscreenNotification"])
        {
            self.supportedOrientation=UIInterfaceOrientationMaskPortrait;
    
        }
     }
     - (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window  {
        return self.supportedOrientation;
    }
    
    

提交回复
热议问题