本文介绍了Swift:重新加载视图控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
点击某个按钮时,我需要刷新视图控制器
。简单地激活 viewDidLoad()
似乎不适用于我需要做的事情。但是,当我离开视图控制器
然后回到它,它似乎完美无缺?
I need to refresh a view controller
when a certain button is tapped. Simply activating viewDidLoad()
does not seem to be working for what I need to do. However, when I leave the view controller
then come back to it, it seems to work perfectly?
怎么能我刷新/重新加载一个视图控制器
就像我离开它然后回到它而没有真正离开它?
How can I refresh/reload a view controller
as if I have left it then come back to it without ever actually leaving it?
推荐答案
无论您在 viewDidLoad
中编写什么代码,请尝试在 viewWillappear()中添加
。我想这会解决你的问题。
Whatever code you are writing in viewDidLoad
, try to add that in viewWillappear()
. I think this will solve your problem.
这篇关于Swift:重新加载视图控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!