如何隐藏MPmoviePlayerController控件栏

时间:2012-02-21 08:12:17

标签: ios xcode cocoa-touch

如何隐藏MPmoviePlayerController的控制栏。

我只是想让电影全屏,并且没有任何内容。

NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:dataPath ofType:@""]];
        moviePlayerController = [[MPMoviePlayerController alloc] initWithContentURL:url];
        [[NSNotificationCenter defaultCenter] addObserver:self
                                                 selector:@selector(moviePlaybackComplete:)
                                                     name:MPMoviePlayerPlaybackDidFinishNotification
                                                   object:moviePlayerController];  

        [self.view addSubview:moviePlayerController.view];
        [moviePlayerController.view setFrame:CGRectMake(0, 0, 1024, 768)];
        moviePlayerController.fullscreen = YES;
        if ([moviePlayerController respondsToSelector:@selector(setAllowsAirPlay:)])    
            //Allow airplay ifavailabe
        [moviePlayerController setAllowsAirPlay:YES];

        [moviePlayerController play];

1 个答案:

答案 0 :(得分:14)

moviePlayerController.controlStyle = MPMovieControlStyleNone;