2012-10-25 84 views
2

我需要在播放一個小樂隊視頻期間禁用總體用戶交互,我已經嘗試將控件的樣式設置爲none:MPMovieControlStyleNone,並將UIView放在MPMoviePlayerController之上,但是當我捏視頻消失,聲音仍在播放,就像我解散了視頻一樣,但仍然在後臺播放,而且用戶交互功能被禁用。 我繼承人怎麼辦:禁用MPMoviePlayerController中的用戶交互

-(IBAction)startGame:(id)sender 
{ 
    NSURL * url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"Teste" ofType:@"m4v"]]; 
    moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url]; 

    [[NSNotificationCenter defaultCenter] addObserver:self 
              selector:@selector(moviePlayBackDidFinish:) 
               name:MPMoviePlayerPlaybackDidFinishNotification 
               object:moviePlayer]; 

    moviePlayer.controlStyle = MPMovieControlStyleNone; 
    moviePlayer.shouldAutoplay = YES; 
    [self.view addSubview:moviePlayer.view]; 
    [moviePlayer setFullscreen:YES animated:YES]; 

    mBlankView = [[UIView alloc] initWithFrame:moviePlayer.view.frame]; 
    mBlankView.userInteractionEnabled = NO; 
    [mBlankView setMultipleTouchEnabled:NO]; 
    [mBlankView setBackgroundColor:[UIColor clearColor]]; 
    [self.view addSubview:mBlankView]; 
} 

回答

2

要禁用Movieplayer完全控制u需要禁用您movieplayers瀏覽器用戶交互如下:

moviePlayer.view.userInteractionEnabled = NO; 
+0

不工作'[moviePlayer.view setUserInteractionEnabled:NO];'' moviePlayer.view.userInteractionEnabled = NO;' – darkman