将MPMoviePlayerController旋转到Landscape - iPhone SDK

问题描述:

我想将我的MPMoviePlayerController旋转到横向视图,但它始终保持纵向模式。我在UIViewController中执行此操作,当我处于全屏模式时仍无法旋转我的MPMoviePlayerController。我必须对shouldAutorotatetoOrientation方法做些什么吗?如果有人知道如何做到这一点,请留下回复!将MPMoviePlayerController旋转到Landscape - iPhone SDK

感谢,

凯文

UIViewController class reference

默认情况下,仅在纵向模式UIViewController类显示器的看法。为了支持额外的方向,你必须重写shouldAutorotateToInterfaceOrientation:方法,并为你的子类支持的任何方向返回YES。如果视图的自动调整属性配置正确,那可能就是你所要做的。但是,UIViewController类为您提供额外的挂钩,以根据需要实现其他行为。

例如,如果您autoresizingMask设置为UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight,和你的电影播放器​​视图的父视图具有autoresizesSubviews = YES,然后从shouldAutorotateToInterfaceOrientation返回YES可能是所有你需要做的。

+0

谢谢,但我已经手动得到它通过塑造我以lanscape尺寸和旋转我的MPMoviePlayerController工作。但是现在我已经导致了当我启用[moviePlayer setControlStyle:MPMovieControlStyleFullScreen]时,我的完成按钮不工作的问题; – lab12 2010-09-13 22:11:27

我发现这种方式只是有用的,但它是timetaking设置所需的帧 -

theMovie=[[MPMoviePlayerController alloc] initWithContentURL:theURL]; 
// Rotate the view for landscape playback 
[[theMovie view] setBounds:CGRectMake(-230, 155, 480, 350)]; 
[[theMovie view] setTransform:CGAffineTransformMakeRotation(M_PI/2)];