2

MPMovieControlStyleNone我需要在播放小视频期间禁用全部用户交互,我已经尝试将控件的样式设置为UIViewMPMoviePlayerController我关闭了视频,但它仍在后台播放,而且用户交互被禁用。以下是我的做法:

-(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];
}
4

1 回答 1

2

To disable Movieplayer control completely u need to disable your movieplayers view userinteraction as follows:

moviePlayer.view.userInteractionEnabled = NO;
于 2012-10-25T13:24:51.593 回答