iphone:在mpmovieplayercontroller中旋转? [英] iphone: rotation in mpmovieplayercontroller?

查看:62
本文介绍了iphone:在mpmovieplayercontroller中旋转?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在mpmovieplayercontroller上有一个小视图。当它不是全屏时,我能够将视图的框架调整到方向(当设备旋转时)。但是当我进入全屏模式时,如果我设法呈现视图,我不再能够在设备旋转时保持正确的帧。它看起来像在全屏模式下,系统只是在状态栏和moviePlayer上使用CGAffineTransformRotate。如何应用此CGAffineTransformRotate正确旋转我的视图?

I have a small view on top of an mpmovieplayercontroller. When it is not fullscreen, I am able to adjust the frame of the view to the orientation (when the device rotates). But when I enter fullscreen mode, alothough I manage to present the view, I'm no longer able to maintain the correct frame when the device rotates. It looks like in fullscreen mode, the system simply using CGAffineTransformRotate on the status bar and the moviePlayer. How can I apply this CGAffineTransformRotate to rotate my view correctly?

编辑:

好的,所以我更新了代码,在更改了mpmovieplayercontroller的方向后,在X轴上旋转了90%,但视图在第一次旋转后消失了。这是我的代码:

Ok, so I updated the code to rotate 90% in the X axis after a change in orientation of the mpmovieplayercontroller but the view simply disappears after the first rotate. Here is my code:

- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration{


     float   angle = M_PI / 2;  //rotate 180°, or 1 π radians
     theView.layer.transform = CATransform3DMakeRotation(angle, 1.0, 0.0, 0.0);


    [self changePositionBasedOnOrientation:toInterfaceOrientation]; //here we change the frame of the view


}


推荐答案

好的,

因此,全屏覆盖mpmovieplayercontroller的最佳方式就是:

So the best way to overlay the mpmovieplayercontroller in fullscreen is to it like that:

[[[[[UIApplication sharedApplication] keyWindow] subviews] objectAtIndex:0] addSubview:mySubview]

这有点hacky,但合法。它为您提供了一种简单的方法来处理旋转(而不是使用转换)。

It's a bit hacky, but legitimate. It gives you an easy way to deal with rotations (instead of using transformations).

这篇关于iphone:在mpmovieplayercontroller中旋转?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆