如何在不同时间调用viewDidLoad?

发布于 2024-09-13 06:30:10 字数 220 浏览 2 评论 0原文

我想问一个关于iPhone应用程序的问题。

在我的程序中,我创建了带有 4 个选项卡的 UITabBarController。 4个选项卡显示不同的信息并且有一定的联系。当我在选项卡 4 中执行某些操作时,它将更新选项卡 1 中显示的一些数据。但是,如果我在 viewDidLoad 函数中添加元素,页面是相同的。

我的问题是,如何在用户每次按下选项卡时加载数据?我需要将代码移动到某个地方吗?

I want to ask a question about the iPhone application.

In my program, I create the UITabBarController with 4 tabs. The 4 tabs display different information and have some connection. When I do something in the tab 4, it will update some data which display in tab 1. However, the page is the same if I add the element in the viewDidLoad function.

My problem is, how to load the data every time when the user press the tab? do I need to move the code to somewhere?

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

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

发布评论

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

评论(1

随遇而安 2024-09-20 06:30:10

[UIViewController viewWillAppear:] 正是您正在寻找的。

[UIViewController viewWillAppear:] is exactly what you're looking for.

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