我正在使用MPMovieController作为基础创建自定义MovieController。我可以通过调用
将视频切换到全屏_[moviePlayer setFullscreen:YES animated:YES];_
调用相同的功能( [moviePlayer setFullscreen:NO animated:YES]; )将电影播放器恢复到原始状态(即当用户按下完成按钮时)不起作用。< / p>
作为替代方案,我也尝试过 -
a)听取 MPMoviePlayerDidExitFullscreenNotification 并调用 moviePlayBackDidFinish:功能。
b)使用此功能从“完成”功能中发布自定义通知 -
NSDictionary *thisDictionary = [NSDictionary dictionaryWithObject:[NSNumber numberWithInt:MPMovieFinishReasonUserExited] forKey:MPMoviePlayerPlaybackDidFinishReasonUserInfoKey];
[[NSNotificationCenter defaultCenter] postNotificationName:MPMoviePlayerDidExitFullscreenNotification object:moviePlayer userInfo:thisDictionary];
但在所有这些情况下,电影播放器视图都不会回到原来的状态。
请帮助。
谢谢!
答案 0 :(得分:0)
您必须注册活动通知。当您准备播放视频时,请执行此操作
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayBackDidFinish:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:nil];
并在你的moviePlayBackDidFinish选择器中,这样做
[[UIApplication sharedApplication] setStatusBarHidden:YES];
[[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerPlaybackDidFinishNotification
object:nil];
[self dismissModalViewControllerAnimated:YES];