2012-05-28 101 views
0

我有一個應用程序,我正在按一下按鈕播放電影。我的電影是透明的。當我點擊按鈕時,我的電影可以正常播放,但問題是它的背景色保持白色。我希望電影的背景顏色是透明的。這是我玩電影的代碼。播放透明背景的電影

-(IBAction)ClickFunny:(id)sender 
{ 
    NSString *url = [[NSBundle mainBundle] 
        pathForResource:@"Moviename" 
        ofType:@"mov"]; 
    MPMoviePlayerController *playerController = 
    [[MPMoviePlayerController alloc] 
    initWithContentURL:[NSURL fileURLWithPath:url]]; 
    playerController.controlStyle =MPMovieControlStyleNone; 
    playerController.scalingMode = MPMovieScalingModeAspectFill; 
    playerController.fullscreen = YES; 


     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(movieFinishedCallback:) name:MPMoviePlayerPlaybackDidFinishNotification object:playerController]; 
    playerController.view.frame = CGRectMake(84, 250, 150, 10); 
    [self.view addSubview:playerController.view]; 

    [playerController play]; 



} 
- (void) movieFinishedCallback:(NSNotification*) aNotification { 
    MPMoviePlayerController *player = [aNotification object]; 
    [[NSNotificationCenter defaultCenter] 
    removeObserver:self 
    name:MPMoviePlayerPlaybackDidFinishNotification 
    object:player]; 
    [player stop]; 
    [player.view removeFromSuperview]; 
    [player autorelease]; 
} 
+0

參考[this](http://stackoverflow.com/questions/1401517/iphone-sdk-how-to-play-a-video-with-transparency)link.hope你得到你的答案 –

+0

rani can u post該拍攝 – iLearner

+0

@Bhurudada我可以給你發電影 – Rani

回答

0

您是否嘗試過設置PlayerController的背景顏色?

playerController.view.backgroundColor = [UIColor clearColor]; 
+0

是的,但它不工作 – Rani