views:

230

answers:

2

Hello,

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

A: 

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?

davbryn
The think is that viewWillAppear is only called once and not each time I click on the tab. I would need to release / init the view each time the tab is clicked in order to have this viewWillAppear method triggered. But you right, the fonction I will need to call (http request) is located in viewWillAppear.
Luc
A: 

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.

MattLeff