【问题标题】:Cannot dismiss a VIewController after dismissing a MediaplayerViewController关闭 MediaplayerViewController 后无法关闭 VIewController
【发布时间】: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的视图都会发生这种情况。

【问题讨论】:

    标签: iphone uiviewcontroller


    【解决方案1】:

    试试[self.parentViewController dismissModalViewControllerAnimated];

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-06-30
      • 2013-03-23
      • 2015-07-02
      • 2016-09-17
      • 1970-01-01
      相关资源
      最近更新 更多