iphone - 强制MPMoviePlayerController以横向模式播放视频

sol*_*sol 3 iphone video objective-c mpmovieplayercontroller

我有一个仅限肖像模式的应用程序,但是当用户播放视频时,我希望它以全屏横向模式播放(视频播放器在纵向模式下看起来不太好).我这样玩:

[self.view addSubview:myMoviePlayer.view];
[self.myMoviePlayer setFullscreen:YES animated:YES];
[self.myMoviePlayer play];
Run Code Online (Sandbox Code Playgroud)

实现这一目标的最佳方法是什么?

Mur*_*tam 7

阅读这篇文章:

http://iosdevelopertips.com/video/getting-mpmovieplayercontroller-to-cooperate-with-ios4-3-2-ipad-and-earlier-versions-of-iphone-sdk.html

主要想法是:

[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight animated:NO];

[[self view] setBounds:CGRectMake(0, 0, 480, 320)];
[[self view] setCenter:CGPointMake(160, 240)];
[[self view] setTransform:CGAffineTransformMakeRotation(M_PI / 2)];
Run Code Online (Sandbox Code Playgroud)