gpt4 book ai didi

ios - 对 ParentViewController 开始/结束外观转换的不平衡调用

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:37:42 25 4
gpt4 key购买 nike

ParentViewController 中,我有

    [some_vc dismissViewControllerAnimated:YES completion:nil];
ViewController *vc = [[ViewController alloc] initWithNibName:nil bundle:nil];
vc.someData = data;
[self.navigationController pushViewController:vc animated:NO];

我在日志中收到以下消息

Unbalanced calls to begin/end appearance transitions for ParentViewController: 0x7ff118750d50.

如果我把“NO”改成“YES”

    [self.navigationController pushViewController:vc animated:YES];

我没有看到消息。

可能是什么问题。请帮我解决这个问题。

最佳答案

这是完成处理程序的用途。试试这个:

[some_vc dismissViewControllerAnimated:YES completion:^{
ViewController *vc = [[ViewController alloc] initWithNibName:nil bundle:nil];
vc.someData = data;
[self.navigationController pushViewController:vc animated:NO];
}];

这确保在前一个 Controller 完成关闭之前不会显示新 Controller 。

另一种选择是颠倒顺序:

ViewController *vc = [[ViewController alloc] initWithNibName:nil bundle:nil];
vc.someData = data;
[self.navigationController pushViewController:vc animated:NO];
[some_vc dismissViewControllerAnimated:YES completion:nil];

这会推送新 Controller ,然后关闭模态。这样做的好处是当模态被关闭时新的是可见的。

关于ios - 对 ParentViewController 开始/结束外观转换的不平衡调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26951551/

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