xcode 如何隐藏 MPmoviePlayerController 的控制栏

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9374149/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 23:23:01  来源:igfitidea点击:

How to hide the MPmoviePlayerController's control bar

iosxcodecocoa-touch

提问by user1088940

How to hide the MPmoviePlayerController's control bar.

如何隐藏 MPmoviePlayerController 的控制栏。

I just want to make the movie get a fullscreen and have nothing on it.

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

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];

回答by beryllium

moviePlayerController.controlStyle = MPMovieControlStyleNone;