按下选项卡时重新加载视图控制器

发布于 2024-09-10 16:07:16 字数 148 浏览 3 评论 0原文

我的标签栏控制器中有几个选项卡,只有一个(第一个)每次选择其选项卡时(以及当应用程序返回前台时)都需要自动重新加载。

我没有找到如何执行此操作,是否需要每次都手动重新创建选项卡栏控制器?我是否需要向选项卡栏控制器添加一组新的视图控制器?

感谢您的帮助

I have several tabs in my tab bar controller and only one (the first one) for which I would need an automated reload each time I select its tab (and also when the app come back to the foreground).

I did not find how to do this, do I need to recreate the tab bar controller manually each time ? Do I need to add a new set of view controllers to the tab bar controller ?

Thanks for your help

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

守不住的情 2024-09-17 16:07:16

拥有一个可以在该特定视图上的 viewWillAppear 中调用的 updateView 函数是否有意义,以确保每次设置视图显示时所有内容都是最新的?

Would it make sense to have a updateView functio that you can call in viewWillAppear on that particular view that ensures everything is up-to-date each time the view is set to appear?

唐婉 2024-09-17 16:07:16

如果你的UIViewController是一个UITabBarControllerDelegate它将得到这个回调,这就是你想要的,我相信:

- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController

在调用你的后简单地返回YES >updateView 方法。

If your UIViewController is a UITabBarControllerDelegate it will get this callback, which is what you want, I believe:

- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController

Simply return YES after calling your updateView method.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文