Dismissviewcontroller并执行segue

我需要使用performSegueWithIdentifier转到另一个viewcontroller,但我还需要删除我当前所在的viewcontroller。我怎么能这样做,我试过这个但它不起作用:

 [self performSegueWithIdentifier:@"next" sender:self]; [self dismissViewControllerAnimated:NO completion:nil]; //tried the other way, but it doesn't work either [self dismissViewControllerAnimated:NO completion:nil]; [self performSegueWithIdentifier:@"next" sender:self]; 

看起来没有任何简单的方法可以做到这一点? 我有4个viewcontrollers,它们是这样连接的,我想从gameover到highscore。

 menu-->game----->gameover menu-->highscore 

这个怎么样?

 UIViewController *parentController = self.presentingViewController; [picker dismissViewControllerAnimated:YES completion:^(void){ [parentController performSegueWithIdentifier:@"next" sender:self]; }]; 

我遇到了同样的问题,如果有人来这里寻找答案,这就是我要解决的问题。

 //In viewController that is being dismissed [self dismissViewControllerAnimated:NO completion:^{ [[NSNotificationCenter defaultCenter] postNotificationName:@"callSegue" object:self]; }]; //In viewController being presented //in viewDidLoad: [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(gotoNewView) name: @"callSegue" object: nil]; -(void)gotoNewView { [self performSegueWithIdentifier:@"segueToPerform" sender:self]; } 

我遇到了同样的问题,直到我意识到我应该使用push segue。
新VC将立即解雇他们。

更好的是:

 [self dismissViewControllerAnimated:NO completion:^(void) { // Perform the segue here. }];