将 MPMoviePlayerController 旋转为横向 - iPhone SDK

发布于 2024-09-19 01:47:49 字数 208 浏览 2 评论 0原文

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

谢谢,

凯文

I am trying to rotate my MPMoviePlayerController to landscape view, but it always stays in portrait mode. I am doing this in a UIViewController and I still can't rotate my MPMoviePlayerController when I am in full screen mode. Do I have to do something to the shouldAutorotatetoOrientation method? If anyone knows how to do this please leave a reply back!!

Thanks,

Kevin

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

看春风乍起 2024-09-26 01:47:49

来自 UIViewController 类参考

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

例如,如果您的 autoresizingMask 设置为 UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight,并且电影播放器​​视图的父视图具有 autoresizesSubviews = YES,那么从 shouldAutorotateToInterfaceOrientation 返回 YES 可能就是您需要做的全部事情。

From the UIViewController class reference:

By default, the UIViewController class displays views in portrait mode only. To support additional orientations, you must override the shouldAutorotateToInterfaceOrientation: method and return YES for any orientations your subclass supports. If the autoresizing properties of your views are configured correctly, that may be all you have to do. However, the UIViewController class provides additional hooks for you to implement additional behaviors as needed.

For example, if your autoresizingMask is set to UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight, and the parent view of your movie player view has autoresizesSubviews = YES, then returning YES from the shouldAutorotateToInterfaceOrientation may be all you need to do.

神魇的王 2024-09-26 01:47:49

我发现这种方法很有用,但设置所需的框架很花时间-

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)]; 

i found this way only useful but it is timetaking to set the desired frame-

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)]; 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文