开发者

Cannot dismiss a VIewController after dismissing a MediaplayerViewController

开发者 https://www.devze.com 2023-03-31 18:50 出处:网络
I have a view controller presenting a MediaViewController and after that I cannot get the first view to dismiss.

I have a view controller presenting a MediaViewController and after that I cannot get the first view to dismiss.

Apparently it might not work if both views are dismissed animated:YES, but I have tried all variants and still no luck.

I create and present the MediaPlayerViewController like so

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];

The following code should dismiss the views

-(void)videoPlayBackDidFinish:(NSNotification*)notification
{       
    AppstersAppDelegate *appDelegate = (AppstersAppDelegate *)[[UIApplication sharedApplication] delegate];

   // [appDelegate continueSetup];

    [self dismissMoviePlayerViewControllerAnimated];

    [appDelegate.viewController dismissModalViewControllerAnimated:NO开发者_StackOverflow];
}

The viewController on the appDelegate is the rootViewController

I have also tried calling dismissModalViewControllerAnimated on self, but it didnt solve the issue.

The weird thing is that this is happening with each view that is presenting a movieViewController.


Try [self.parentViewController dismissModalViewControllerAnimated];

0

精彩评论

暂无评论...
验证码 换一张
取 消