Ios7 电影播放器-播放结束后出现黑屏
我遇到的问题是,当我按下完成按钮或电影完成播放时,会出现一个黑屏。我想回到我放置UIImage的开始屏幕Ios7 电影播放器-播放结束后出现黑屏,ios7,mpmovieplayercontroller,Ios7,Mpmovieplayercontroller,我遇到的问题是,当我按下完成按钮或电影完成播放时,会出现一个黑屏。我想回到我放置UIImage的开始屏幕 -(void)playMovie:(id)sender { NSString * str=[[NSBundle mainBundle]pathForResource:@"yo2" ofType:@"mov"]; NSURL * url=[NSURL fileURLWithPath:str]; MPMoviePlayerController * movieContro
-(void)playMovie:(id)sender
{
NSString * str=[[NSBundle mainBundle]pathForResource:@"yo2" ofType:@"mov"];
NSURL * url=[NSURL fileURLWithPath:str];
MPMoviePlayerController * movieController=[[MPMoviePlayerController alloc]initWithContentURL:url];
movieController.controlStyle=MPMovieControlStyleFullscreen;
[movieController.view setFrame:self.view.bounds];
[self.view addSubview:movieController.view];
[movieController prepareToPlay];
[movieController play];
_moviePlayer = [[MPMoviePlayerController alloc]
initWithContentURL:url];
_moviePlayer.controlStyle = MPMovieControlStyleDefault;
_moviePlayer.shouldAutoplay = YES;
[self.view addSubview:_moviePlayer.view];
[_moviePlayer setFullscreen:YES animated:YES];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayBackDidFinish:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:_moviePlayer];
}
- (void) moviePlayBackDidFinish:(NSNotification*)notification {
// Remove observer
[[NSNotificationCenter defaultCenter] removeObserver:self
name:MPMoviePlayerPlaybackDidFinishNotification
object:nil];
[self dismissViewControllerAnimated:YES
completion:^{
[self performSegueWithIdentifier:@"back" sender:self];
}];
}
@end
这听起来好像当用户按下“完成”按钮时,通知处理程序根本没有被调用,对吗?是的,类似这样。当我按下“完成”按钮时,电影就消失了。黑屏上显示的是。有什么想法吗?