Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在导航堆栈顶部的视图(比如说 VC1)上。我单击另一个选项卡并返回此视图,VC1 中的内容重新加载。在这种情况下如何停止重新加载内容,因为重新加载没有任何意义,因为视图已经加载了内容。
override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(true) loadContent() }
您不能停止viewWillAppear从 2 个相同的操作(例如切换选项卡或弹出覆盖 vc )中被调用,因此您需要为viewWillAppear弹出调用后需要重新加载的 vc 删除并分配一个委托 loadContent
viewWillAppear
loadContent