Question

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)

Was it helpful?

Solution

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

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top