MPMoviePlayerController only rotate on fullscreen

落花浮王杯 提交于 2019-12-11 07:16:47

问题


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:


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

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    if (!self.fullscreen) {
        return UIDeviceOrientationIsPortrait(interfaceOrientation);
    }
    return YES;
}


来源:https://stackoverflow.com/questions/8421061/mpmovieplayercontroller-only-rotate-on-fullscreen

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!