gpt4 book ai didi

objective-c - 关闭 Viewcontroller 并执行 segue

转载 作者:可可西里 更新时间:2023-11-01 05:23:14 25 4
gpt4 key购买 nike

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

[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 个 View Controller ,它们是这样连接的,我想从游戏结束到高分。

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

最佳答案

这个怎么样?

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

关于objective-c - 关闭 Viewcontroller 并执行 segue,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13733263/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com