iPad上的MPMediaPickerController方向

Ser*_*nev 6 iphone ipod mpmediapickercontroller

如何设置MPMediaPickerController的正确方向?

我在shouldAutorotateToInterfaceOrientation中返回YES,但我的Landscape框架不好(如果在Portrait中首先显示MPMediaPickerController,反过来).

我混乱地旋转我的设备,有时候设置框架来纠正自己!我找到了通过旋转设置框架的方法 - 需要旋转到180度.例如,如果你在Portrait中有一个好帧,当你旋转到Landscape时 - 你有一个坏帧(来自Portatait),但是如果你旋转到其他景观(到180度),那么帧设置为Landscape ...为什么?

如何在旋转后始终设置框架?

问候,

jil*_*lu_ -1

这是一些示例代码,您可以尝试一下,旋转后,您必须在 self.view 的中心设置媒体播放器视图,这里是一些示例代码...您必须首先添加 MediaPlayer 框架...

NSString* moviePath = [[NSBundle mainBundle] pathForResource:@"PATRON_LOGO_3" ofType:@"mp4"];
NSURL* movieURL = [NSURL fileURLWithPath:moviePath];
 MPMoviePlayerController *playerCtrl =  [[MPMoviePlayerController alloc]initWithContentURL:movieURL];
playerCtrl.scalingMode = MPMovieScalingModeFill;
playerCtrl.controlStyle = MPMovieControlStyleNone;
[playerCtrl.view setCenter:CGPointMake(240, 160)];
[playerCtrl.view setTransform:CGAffineTransformMakeRotation(M_PI/2)];
playerCtrl.view.frame = CGRectMake(0, 0, 320, 480);
[self.view addSubview:playerCtrl.view];
[playerCtrl play];
Run Code Online (Sandbox Code Playgroud)

我认为它工作得很好,这是针对肖像的横向模式,我们必须根据肖像框架设置框架,例如..

playerCtrl.view.frame = CGRectMake(0, 0, 480, 320);

之后我们必须设置为视图中心。