2009-05-12 196 views
1

我正在使用MPMoviePlayer流式传输MP3文件,我希望在后台显示一个图像而不是默认的Quicktime徽标。MPMoviePlayer音频专辑艺术

我发现了一种将图像叠加到播放器上的方法,但问题在于,您必须在图像外部轻敲以获取播放器控件。当它们确实出现时,它们在图像下面。

有人知道如何做到这一点吗?

感谢, 约翰

回答

0

大部分iPhone上的每一个应用程序是由视图的层次的。你可以去到电影播放器​​的顶部根节点和递归走在孩子的意见,并设置hidden值YES,直到你找到合适的项目,然后插入您的UIImageView该项目下面。这样,控件始终保持最佳状态,并且仍然对用户输入做出响应。

您运行的风险是如果Apple更改MPMoviePlayer用户界面并洗牌视图层次结构,但您可能有很多提前通知,并且可以修补您的应用程序以允许新布局。

有这是否是犹太对AppStore的应用程序的问题,而是目前许多应用程序(尤其是相机/拍照的人)这样做是为了摆脱标准的窗口元素。

+0

我发现如果你做深度优先搜索,你想添加的UIImageView作为子视图是你访问的第一个。 – mclin 2010-10-26 12:40:03

0

使用AVAudioPlayer并实现您自己的播放器UI。

0

,将工作检查此

MPMoviePlayerController *moviePlayerController=[[MPMoviePlayerController alloc] initWithContentURL:theURL]; 
moviePlayerController.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"Default.png"]]; 
2

的backgroundColor已被弃用,潜入私人景观结构是很危险的。这对我很好:

 UIImageView *coverImageView = [[UIImageView alloc] initWithImage:coverImage]; 
     coverImageView.contentMode = UIViewContentModeScaleAspectFit; 
     coverImageView.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight; 
     coverImageView.frame = moviePlayerController.view.bounds; 
     [moviePlayerController.view addSubview:coverImageView]; 
相关问题