淡出 MPMoviePlayerController 控件 [英] Fading out MPMoviePlayerController controls
问题描述
当我在 MPMoviePlayerController 中开始播放电影时,控件会在顶部停留几秒钟.之后,它们逐渐淡出.
When I start a movie in a MPMoviePlayerController, controls stay at the top for few seconds. After that, they fade out.
当我在 controlStyle 属性中使用 MPMovieControlStyleNone 时,我想模拟这种效果,但控件突然消失了.我尝试使用以下代码使用动画但没有成功:
I want simulate this effect when I use MPMovieControlStyleNone in controlStyle property, but controls disappear abruptly. I tried to use animations without success with the following code:
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.50f];
self.myMoviePlayer.controlStyle = MPMovieControlStyleNone;
[UIView commitAnimations];
有人知道我怎么做吗?
任何帮助将不胜感激.
谢谢.
推荐答案
如果我理解正确,您打算以与原始控件类似的方式隐藏自定义控件.
If I understand you correctly, you are planning to hide custom controls in a similar fashion to the original controls.
您将需要使用类似
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.50];
self.customControlsView.alpha = 0.0f;
[UIView commitAnimations];
达到那个效果.controlStyle
不是可动画的属性.
to achieve that effect. controlStyle
is not an animatable property.
最重要的是,您需要在 MPMoviePlayerController
的整个生命周期中始终坚持 controlStyle = MPMovieControlStyleNone
,因为这是防止原始控件出现的唯一方法.
On tops, you will need to stick to controlStyle = MPMovieControlStyleNone
anyways throughout the lifetime of your MPMoviePlayerController
as that is the only way to prevent the original controls from appearing.
这篇关于淡出 MPMoviePlayerController 控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!