问题描述
我正在尝试更改我的MPMoviePlayerController的背景颜色,我无法坚持下去。
I'm trying to change the background color of my MPMoviePlayerController, and I can't get it to stick.
我正在使用:
moviePlayer.view.backgroundColor = [UIColor redColor];
视频加载时,我可以看到背景闪烁红色。加载后,背景再次变黑。我已经尝试在播放开始后设置颜色,但这没有效果。
I can see the background flash red while the video is loading. As soon as it is loaded, the background goes black again. I've tried setting the color after playback has started, but that has no effect.
我正在使用iOS 5.
I'm using iOS 5.
编辑:我实际上是在尝试将背景设置为[UIColor clearColor],而不是红色。我应该首先正确地提出我的问题。
I'm actually attempting to set the background to [UIColor clearColor], not red. I should have asked my question properly in the first place.
推荐答案
backgroundColor
on 不推荐使用MPMoviePlayerController
,并将 view
记录为只读。请参阅:
backgroundColor
on MPMoviePlayerController
is deprecated and view
is documented as read-only. See: Deprecated MPMoviePlayerController Methods
@属性(非原子,保留)UIColor * backgroundColor
@property (nonatomic, retain) UIColor *backgroundColor
所以我会尝试使用:
moviePlayer.backgroundView.backgroundColor = [UIColor redColor];
这篇关于MPMoviePlayerController背景颜色不会粘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!