`iSmovingToparentViewController`/`iSmovingToparent`错误true

发布于 2025-01-26 15:51:11 字数 286 浏览 3 评论 0原文

在我的视图控制器中,我正在检查iSmovingToparent viewwillappear ,这样我才能在首次显示视图控制器并且不是时才能执行一些逻辑。当后来的视图控制器从堆栈中弹出以揭示我的原始控制器时。

我希望此值是true,当VC首次推到导航堆栈和false时出现时,由于后来的VC弹出了堆栈。

但是,在这两种情况下,该值最终都是true。有什么原因会发生这种情况?

In my view controller, I am checking for isMovingToParent inside viewWillAppear so that I can execute some logic only when the view controller is first displayed and not when a later view controller is popped off the stack to reveal my original one.

I would expect this value to be true when the VC is first pushed onto the navigation stack and false when it appears because of a later VC popping off the stack.

However, in both cases, the value ends up being true. Any reason why this would be happening?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

非要怀念 2025-02-02 15:51:11

您是否覆盖任何didmove(toparent:)/willmove(toparent:)方法?如果是这样,请确保您正在调用超级的该方法的版本。如果您不这样做,则似乎错误地设置了iSmovingToparent一系列属性。

注意:如果有人有证明上述行为的文档,请编辑答案:)

Are you overriding any of the didMove(toParent:)/willMove(toParent:) methods? If so, make sure you are calling super's version of that method. If you fail to do so, the isMovingToParent series of properties seemingly can be incorrectly set.

Note: If anyone has documentation attesting to the above behaviour, please edit the answer :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文