`iSmovingToparentViewController`/`iSmovingToparent`错误true
在我的视图控制器中,我正在检查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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否覆盖任何
didmove(toparent:)
/willmove(toparent:)
方法?如果是这样,请确保您正在调用超级
的该方法的版本。如果您不这样做,则似乎错误地设置了iSmovingToparent
一系列属性。注意:如果有人有证明上述行为的文档,请编辑答案:)
Are you overriding any of the
didMove(toParent:)
/willMove(toParent:)
methods? If so, make sure you are callingsuper
's version of that method. If you fail to do so, theisMovingToParent
series of properties seemingly can be incorrectly set.Note: If anyone has documentation attesting to the above behaviour, please edit the answer :)