문제

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)

도움이 되었습니까?

해결책

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

다른 팁

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top