gpt4 book ai didi

iphone - 弹出到主视图 Controller

转载 作者:行者123 更新时间:2023-11-29 03:33:53 26 4
gpt4 key购买 nike

在我的应用程序中,我有 2 个 View Controller ,它们通过使用模式转换出现,现在我开发了第三个 View Controller ,并放置了一个按钮返回主视图 Controller ,但是我如何返回到主视图 Controller ?我尝试过这个:

[self dismissViewControllerAnimated:YES completion:nil];

但是通过这段代码我回到了第二个 View Controller 。我该如何解决它?

谢谢!

最佳答案

假设您的第一个模式呈现了第二个模式,则以下内容应该有效:

__weak UIViewController *vcThatPresentedCurrent = self.presentingViewController;

[self dismissViewControllerAnimated:YES completion:^{

[vcThatPresentedCurrent dismissViewControllerAnimated:YES completion:nil];
}];

关于iphone - 弹出到主视图 Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19427655/

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