【发布时间】:2011-08-31 09:09:38
【问题描述】:
我有一个显示 MediaViewController 的视图控制器,之后我无法关闭第一个视图。
如果两个视图都以动画方式关闭,显然它可能不起作用:是的,但我已经尝试了所有变体,但仍然没有运气。
我像这样创建并呈现 MediaPlayerViewController
MPMoviePlayerViewController *mp = [[MPMoviePlayerViewController alloc] initWithContentURL:fileURL];
[mp moviePlayer].controlStyle = MPMovieControlStyleNone;
[[mp moviePlayer] prepareToPlay];
[[mp moviePlayer] setShouldAutoplay:YES];
[mp moviePlayer].fullscreen = YES;
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(videoPlayBackDidFinish:) name:MPMoviePlayerPlaybackDidFinishNotification object:nil];
[self presentMoviePlayerViewControllerAnimated:mp];
以下代码应关闭视图
-(void)videoPlayBackDidFinish:(NSNotification*)notification
{
AppstersAppDelegate *appDelegate = (AppstersAppDelegate *)[[UIApplication sharedApplication] delegate];
// [appDelegate continueSetup];
[self dismissMoviePlayerViewControllerAnimated];
[appDelegate.viewController dismissModalViewControllerAnimated:NO];
}
appDelegate 上的 viewController 是 rootViewController
我也试过在 self 上调用dismissModalViewControllerAnimated,但没有解决问题。
奇怪的是,每个呈现movieViewController的视图都会发生这种情况。
【问题讨论】: