标签栏,每次按下标签时都会重新加载
我正在创建一个应用程序,其中有五个选项卡。每次按下选项卡时我都需要重新加载每个控制器。
I am creating an app in which I have five tabs. I need to reload each controller every time when tab is pressed.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
把你想要重新加载的代码,在视图中将出现或者在视图中确实出现过的所有视图中。
一切顺利。
Put the code you want to reload, in the view will appear or in view did appear of all the view.
All the best.
例子:
Example:
因此,编写一个方法来重绘页面上的元素,并在按下 Tab 键时调用它。如果您提供有关您所面临问题的更多信息,我将编辑这篇文章。
So write a method to redraw the elements on your page and call it on tab press. I will edit this post if you provide more information on the problem you are facing.
如果你正在使用 uitableview 使用这个
if you are you are using the uitableview use this
我希望您谈论的是 webview,每次导航选项卡栏项目时,webview 都应该重新加载,只需在选项卡栏委托中实现 [webview reload] 即可。
I hope you are talking about the webview the webview should reload every time a tabbar item is navigated well just implement [webview reload] in the tab bar delegate.
斯威夫特5
Swift 5