开发者

MPMoviePlayerViewController Finished the App returns Landscape

开发者 https://www.devze.com 2023-01-05 09:54 出处:网络
I have a MPMoviePlayerViewController, while the video plays fine if the video is in landscape, and when it finished the app turns to landscape. After video finished I want the App to remain portrait.

I have a MPMoviePlayerViewController, while the video plays fine if the video is in landscape, and when it finished the app turns to landscape. After video finished I want the App to remain portrait.

MPMoviePlayerViewController *moviePlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:movieURL];
        //[开发者_如何学编程moviePlayer shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationLandscapeLeft];
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlayBackDidFinished:) name:MPMoviePlayerPlaybackDidFinishNotification object:(moviePlayer.moviePlayer)];
        [self  presentMoviePlayerViewControllerAnimated:moviePlayer];
        [moviePlayer.moviePlayer play];


Override your view controller's -shouldAutorotateToInterfaceOrientation: to return YES only for portrait.

0

精彩评论

暂无评论...
验证码 换一张
取 消