gpt4 book ai didi

ios - 在呈现模态视图 Controller 后推送导航 Controller

转载 作者:可可西里 更新时间:2023-11-01 03:45:44 24 4
gpt4 key购买 nike

我有一个选项卡 View Controller ,它有一个像这样的按钮,当它被按下时会出现一个模式:

PostViewController *post = [[PostViewController alloc] init];

// [self.navigationController pushViewController:post animated:YES];

// Presentation
[self presentViewController:post animated:YES completion:nil];

当模态完成后,我想关闭它并像这样推送一个新的 View Controller :

ProfilesViewController *profile = [[ProfilesViewController alloc] init];
[self.navigationController pushViewController:profile animated:YES];

但我不能在 post vc 中将其作为模态来执行。我该怎么做?

最佳答案

您可以尝试使用completionBlock

CompletionBlock 在 presentViewController 完成时调用。

PostViewController *post = [[PostViewController alloc] init];
[con presentViewController:post animated:YES completion:^{
ProfilesViewController *profile = [[ProfilesViewController alloc] init];
[self.navigationController pushViewController:profile animated:YES];
}];

关于 presentViewController:animated:completion: 的更多信息 Apple Doc

completion : The block to execute after the presentation finishes. This block has no return value and takes no parameters. You may specify nil for this parameter.

关于ios - 在呈现模态视图 Controller 后推送导航 Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26273448/

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