MPMoviePlayerController only rotate on fullscreen

2019-08-05 04:59发布

I have a table view that contains an instance of MPMoviePlayerController as the table header and when the user presses my custom overlay button, the video expands to full screen. The aspect ratio of the video is such that in portrait mode it is very small, and I imagine most users will rotate to landscape.

The problem is that I want to allow rotation when the video is full screen but not when it exits. My underlying table does not support landscape. Is there a way to support rotation only when full screen? I thought this would be a standard component of MPMoviePlayerController.

I'm using SDK 5.0, but it was originally built with 4.3.

1条回答
祖国的老花朵
2楼-- · 2019-08-05 05:01

Have you tried subclassing the MPMoviePlayerController MPMoviePlayerViewController class, and overriding the method:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    if (!self.fullscreen) {
        return UIDeviceOrientationIsPortrait(interfaceOrientation);
    }
    return YES;
}
查看更多
登录 后发表回答