cuốn sách gpt4 ai đã làm

ios - 从另一个 Popover 中关闭显示为 Popover segue 的 ViewController

In lại Tác giả: Walker 123 更新时间:2023-11-29 00:27:26 26 4
mua khóa gpt4 Nike

我的 Storyboard使用 UINavigationController(VC0),我使用 UIPopover 来加载新的 UIViewController (VC1)。从这个新的 UIViewController 中,我弹出一个新的 UIViewController (VC2)。当我尝试关闭这个最新的弹出窗口时,我将退出到 UINavigationController.

我在 VC0 中使用的代码将 VC1 显示为弹出窗口,VC1 到 VC2 是相同的代码(尽管标识符不同):

[self performSegueWithIdentifier:@"titlePopover" sender:self];

我在 VC2 中用来关闭弹出窗口的代码是:

UIViewController *vc = [self presentingViewController];
[self dismissViewControllerAnimated:YES completion:^{
[[vc presentingViewController] dismissViewControllerAnimated:YES completion:nil];
}];

它的作用是关闭 VC2,瞬间显示 VC1,然后关闭 VC1 并返回到 VC0。我希望能够只关闭 VC2,这样我就可以使用 VC1

câu trả lời hay nhất

如果您以模态方式执行sugue,请使用代码向后导航:

[self dismissViewControllerAnimated:YES completion:nil];

如果执行推送 segue,使用代码返回:

[self.navigationController popViewControllerAnimated:YES];

关于ios - 从另一个 Popover 中关闭显示为 Popover segue 的 ViewController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42671732/

26 4 0
Walker 123
Hồ sơ

Tôi là một lập trình viên xuất sắc, rất giỏi!

Nhận phiếu giảm giá taxi Didi miễn phí
Phiếu giảm giá taxi Didi
Chứng chỉ ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com
Xem sitemap của VNExpress