1

我有一个视图和一个 MPMoviePlayerViewController .. iPad 以横向左侧模式定向,但是当我播放视频时,视频在纵向模式下很好看……有没有办法强制电影播放器​​在横向模式下旋转?提前致谢

4

2 回答 2

4
@interface MyMovieViewController : MPMoviePlayerViewController
@end

@implementation MyMovieViewController
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
    return UIInterfaceOrientationIsLandscape(toInterfaceOrientation);
}

@end

然后只需实例化 MyMovieViewController 而不是 MPMoviePlayerViewController。

于 2010-06-21T17:00:35.790 回答
3

您可以通过以下方式强制 MPMoviePlayerViewcontroller 在横向模式下工作

[player setOrientation:UIDeviceOrientationPortrait animated:NO];

您可以阅读我的博客文章以获取示例代码http://www.makebetterthings.com/blogs/iphone/play-video-on-iphone-and-ipad/

于 2010-06-08T10:07:29.220 回答