MPMoviePlayerViewController在iPad视图风景
问题描述:
我有一个视图和一个MPMoviePlayerViewController .. iPad是面向横向左模式,但是当我播放视频时,视频很好看在纵向模式... 有没有一种方法强制movieplayer在横向模式下旋转? 由于事先MPMoviePlayerViewController在iPad视图风景
答
可以强制MPMoviePlayerViewcontroller通过
[player setOrientation:UIDeviceOrientationPortrait animated:NO];
在landscapce模式下工作,可以阅读示例代码我的博客文章http://www.makebetterthings.com/blogs/iphone/play-video-on-iphone-and-ipad/
答
@interface MyMovieViewController : MPMoviePlayerViewController
@end
@implementation MyMovieViewController
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
return UIInterfaceOrientationIsLandscape(toInterfaceOrientation);
}
@end
然后只需实例MyMovieViewController代替MPMoviePlayerViewController 。
谢谢Saurabh! 我昨天读了你的博客(我也打了电话),但是在哪里显示我跳过的东西,我不知道怎么回事!!!!! 谢谢,我会尽快尝试! – ghiboz 2010-06-08 10:21:30
对不起,但MPMMoviePlayerViewController没有setOrientation方法... https://developer.apple.com/iphone/prerelease/library/documentation/MediaPlayer/Reference/MPMoviePlayerViewController_class/Reference/Reference.html – ghiboz 2010-06-08 20:11:01
对不起,我阅读进入你的博客setOrientation尚未准备好用于iPad ...... – ghiboz 2010-06-08 20:14:27