i have a uitabarcontroller in which 3 view controller are added .in the 3rd tab i have a picker view which selects some settings based on which data in the 2nd tab changes.When i migrate into 2nd tab the data is not getting refreshed as i have the same old data.How can i refresh the data in the 2nd tab.
NSMutableArray *localControllersArray = [[NSMutableArray alloc] initWithCapacity:3];
MainViewController *mainview;
mainview = [[MainViewController alloc] init];
mainview.tabBarItem.image=[UIImage imageNamed:@"pipeline.png"];
mainview.title=@"Pipeline";
navigationController = [[UINavigationController alloc] initWithRootViewController:mainview];
[localControllersArray addObject:navigationController];
[navigationController release];
[mainview release];
tabBarController.viewControllers = localControllersArray;
[self.view addSubview:tabBarController.view];
This is the way i have added 3 view controller to my tab controller in a view controller.
Best Solution
first of all, as I remember, I had no problems with methods viewDidAppear:(BOOL)animated and viewWillAppear:(BOOL)animated in the tabbar application. another possible solution is to make some methos in your second controller like updateUI, so you can call it from yout tabbar's delegate method
The second variant is rather ugly, but it will work. try to check what is wrong with your viewDidApear: method. maybe you should transfer some UI changes to viewWillApear: method.