gpt4 book ai didi

ios - 为什么不调用 deinit?

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

这是我的代码。我不明白为什么不调用 deinit。

class SplashVC: UIViewController {
init() {
super.init(nibName: nil, bundle: nil)
print("SplashVC created")
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
DispatchQueue.main.asyncAfter(deadline: .now() + 2) { [weak self] in
self?.navigationController?.popViewController(animated: false)
self?.navigationController?.pushViewController(SignupViewController(), animated: true)
}
}
deinit {
print("SplashVC free")
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}

最佳答案

我阅读了文档,现在我知道弹出 Root View Controller 是我的问题。

This method removes the top view controller from the stack and makes the new top of the stack the active view controller. If the view controller at the top of the stack is the root view controller, this method does nothing. In other words, you cannot pop the last item on the stack

关于ios - 为什么不调用 deinit?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58319930/

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