gpt4 book ai didi

ios - 使用 `self.navigationController?.popViewController(animated: true)` 是关闭当前的 ViewController 还是只是返回到前一个?

转载 作者:行者123 更新时间:2023-11-28 12:28:29 26 4
gpt4 key购买 nike

我想知道 self.navigationController?.popViewController(animated: true) 是否真的关闭了正在调用它的 View Controller ,或者它是否只是返回到之前的 View Controller ?如果是这样,这是否意味着我必须在使用上述代码的同时手动关闭 View Controller?谢谢。

最佳答案

当您从 UINavigationController 的导航堆栈中弹出 View Controller 时,UINavigationController 释放弹出的 View Controller ,默认情况下它不存在。您可以通过实现该 View Controller 的 deinit 来看到这一点。

如果您没有看到 deinit 被调用,那么该 View Controller 正在泄漏,因为您有一个保留周期,您需要担心为什么会这样。

关于ios - 使用 `self.navigationController?.popViewController(animated: true)` 是关闭当前的 ViewController 还是只是返回到前一个?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42748989/

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