iPhone SDK:知道何时单击选项卡栏上的选项卡?

发布于 2024-09-01 04:52:58 字数 174 浏览 5 评论 0原文

我有一个选项卡栏,单击时会显示不同的视图。当您第一次单击选项卡时,它会调用 viewDidLoad 方法。但是,它只是第一次调用。

当用户单击返回该选项卡时是否会调用一个方法,因为 viewDidLoad 不会第二次被调用?

(当用户单击返回选项卡时,我需要执行此操作来更新 UITableView)

I have a tab bar which displays different views when clicked. When you click a tab for the first time, it calls the viewDidLoad method. But, it only calls that the first time.

Is there a method that is called when a user clicks back to that tab, since the viewDidLoad won't be called that second time?

(I need to do this to update a UITableView when the user clicks back to a tab)

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

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

发布评论

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

评论(2

缱倦旧时光 2024-09-08 04:52:58

当然!

- (void)tabBarController:(UITabBarController *)aTabBarController didSelectViewController:(UIViewController *)viewController

寻找此类内容时,最好的选择是查看文档,特别是查看您感兴趣的对象的委托。
http://developer.apple.com/ iphone/library/documentation/UIKit/Reference/UITabBarControllerDelegate_Protocol/Reference/Reference.html

Of course!

- (void)tabBarController:(UITabBarController *)aTabBarController didSelectViewController:(UIViewController *)viewController

Your best option when looking for these sorts of things is to look in the documentation, specifically at the delegate for the object you're interested in.
http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UITabBarControllerDelegate_Protocol/Reference/Reference.html

汹涌人海 2024-09-08 04:52:58

我会在 UIViewController 中使用 - (void)viewWillAppear:(BOOL)animated (文档)

I would use - (void)viewWillAppear:(BOOL)animated in UIViewController (docs)

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