2013-12-23 38 views
0

此代碼未設置iOS6中MPMoviePlayerController的背景視圖,但在iOS7中完美工作。mpmovieplayer未在ios6中設置背景

UIView *patternView = [[UIView alloc] initWithFrame:self.view.bounds]; 
patternView.backgroundColor = [UIColor redColor]; 
UIImageView *imgView=[[UIImageView alloc]initWithFrame:self.view.bounds]; 
imgView.image=imgBackGround; 
[patternView addSubview:imgView]; 
[self.moviePlayer.backgroundView addSubview:patternView]; 

什麼是替代方案?

回答

0

您最終設置了背景顏色爲紅色的視圖。如果您只想設置背景顏色,則不需要使用任何視圖並添加視圖,而是直接設置MPMoviePlayerController視圖的背景顏色。

[self.moviePlayer.view setBackgroundColor:[UIColor redColor]];

+0

還有一個imageView,它是最重要的。任何想法? –

+1

你可以添加圖像使用下面的行[self.movi​​ePlayer.view setBackgroundColor:[UIColor colorWithPatternImage:@「your image」]]; –

+0

是的,你可以使用上面的方法...但colorWithPatterImage方法會消耗內存...所以請檢查它! –