MPMoviePlayerController 视图未调整大小
我正在使用 MPMoviePlayerController,它将其 UIView 渲染到横向上的正确尺寸,但当旋转到纵向时,它根本不调整大小。我认为它的父 UIView 是不调整大小的。我该如何设置?
我按照 @Alex Reynolds 在 UIView autoresizingmask not work for me 中提到的说明进行操作。这表明视图在旋转时确实会调整大小。我仍然有一个问题,当加载容纳播放器的 UIViewController 的 UIView 时,如果设备的方向是横向的,它们会渲染到正确的框架,但如果设备在加载时处于纵向,则不会调整其大小。根据 @Alex Reynolds 的回答,我所要做的就是旋转设备一次,之后它将开始正确调整大小。
第一次无法调整大小仍然很糟糕。以前有人发生过这种情况吗?如果是这样,我们将不胜感激任何意见。
I'm working with an MPMoviePlayerController which renders its UIView to the right dimensions on landscape, but when rotating to portrait it is simply not resizing. I think it's parent UIView is the one not resizing. How can I set this up?
I followed the instructions that @Alex Reynolds mentions in UIView autoresizingmask not working for me. This showed me that the view does resize when rotated. I still have the problem that when the UIView
for the UIViewController
that holds the player is loaded, if the orientation of the device is landscape, they it renders to the right frame, but if the devise is on portrait by the time it is loaded it is not resized to it. With @Alex Reynolds' answer, all I have to do is rotate the device once and it will start resizing properly after that.
It is still bad that it won't resize the first time. Has this happened to anyone before? If so, any input is greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否正确设置了 MPMoviePlayerController 的
view
的 autoresizingMask ?其超级视图的autoresizesSubviews
属性是否设置为YES
? (同样,这个超级视图在旋转时也会调整大小吗?我喜欢在测试期间为我的视图设置彩色背景颜色,以验证它们在自动旋转时是否正确调整大小。)如果在检查这些属性后仍然无法正常工作,您可以随时设置影片手动更改玩家视图的
frame
属性。超级视图的layoutSubviews
方法通常是执行此操作的最佳位置,但如果它不是您手动子类化的视图,您也可以在视图控制器中执行此操作。Have you set the MPMoviePlayerController's
view
's autoresizingMask appropriately? Is its superview'sautoresizesSubviews
property set toYES
? (and likewise, does this superview also resize when rotating? I like to set colourful background colours for my views during testing to verify that they resize correctly when autorotating.)If it's still not working after checking those properties, you can always set the movie player's view's
frame
property manually. The super view'slayoutSubviews
method is generally the best place to do that, but if it's not a view you've manually subclassed, you can also do it in the view controller.