Objective c 在MPMoviePlayerController中禁用用户交互
我需要在播放小视频时禁用总用户交互,我已经尝试将控件的样式设置为无:Objective c 在MPMoviePlayerController中禁用用户交互,objective-c,ios,mpmovieplayercontroller,mpmovieplayer,Objective C,Ios,Mpmovieplayercontroller,Mpmovieplayer,我需要在播放小视频时禁用总用户交互,我已经尝试将控件的样式设置为无:MPMovieControlStyleNone,并在MPMoviePlayerController上方放置一个UIView,但当我捏住视频时,声音消失,仍在播放,就像我关闭了视频一样,但它仍然在后台播放,加上用户交互被禁用。 我是这样做的: -(IBAction)startGame:(id)sender { NSURL * url = [NSURL fileURLWithPath:[[NSBundle mainBundl
MPMovieControlStyleNone
,并在MPMoviePlayerController
上方放置一个UIView
,但当我捏住视频时,声音消失,仍在播放,就像我关闭了视频一样,但它仍然在后台播放,加上用户交互被禁用。
我是这样做的:
-(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];
}
要完全禁用Movieplayer控制,您需要禁用Movieplayer查看用户交互,如下所示:
moviePlayer.view.userInteractionEnabled = NO;
不工作
[moviePlayer.view setUserInteractionEnabled:否]
moviePlayer.view.userInteractionEnabled=否代码>