在解雇MediaplayerViewController后无法解除VIewController

时间:2011-08-31 09:09:39

标签: iphone uiviewcontroller

我有一个视图控制器呈现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的视图都会发生这种情况。

1 个答案:

答案 0 :(得分:0)

尝试[self.parentViewController dismissModalViewControllerAnimated];