views:

32

answers:

1

My application uses UITabBarController with 4 tabs. Each tab will have a UIWebView along with other types of objects. When the app launches I need to call the method for this first webView to retrieve my web content.

I have this method in my viewdidLoad: [self performSelectorInBackground:@selector(getAdvisory) withObject:nil];

The web content on the first tab works fine. I'm just at a loss to get my other tabs to load up. I think I would use a switch or if statement but I do not know how to tell which view is loaded.

I need to do the same for the rest of the tabs. The app has a single view controller. When setting an action using a button everything works fine. I just do not know how to call the method when a different view (tapping tabs) loads.

Also when retrieving data from the network, what are the best methods to use to not tie up the main thread? I have read where NSOperation would be used in this scenario. Is this correct? If so how would I go about doing this?

Thanks in advance.

A: 

maybe by using a user delegate of your UITabBar and the method:

- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item

Sent to the delegate when the user selects a tab bar item.

See reference.

Benoît
thanks for the reponse B, I'm going to read up on that method for sure.
tg2007