2011-08-31 90 views
0

我有一個視圖控制器呈現MediaViewController,之後我無法得到第一個視圖解僱。解僱MediaplayerViewController後不能解僱VIewController

顯然它可能不起作用,如果兩個意見都被解僱動畫:是的,但我已經嘗試過所有變種,仍然沒有運氣。

創建和呈現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的

我也打過電話dismissModalViewControllerAnimated對自己,但它沒有解決這個問題。

奇怪的是,這是發生在呈現movieViewController的每個視圖。

回答

0

嘗試[self.parentViewController dismissModalViewControllerAnimated];