tags:

views:

329

answers:

1

Hi ppl..

What I have is a basic 4 tabbar setup with different viewControllers. I have a settings tab that updates a .plist file with the correct settings.

I need tab 1 to update it's on labels, either from the settings tab or on didSelectViewController on the 1 tab. But how do I do this, can't get it to work?

The only thing I have had working is for the user to completely exit the app so that the viewDidLoad method is called, and the view is loaded again.

Hope you can help me :)

Thanks

+1  A: 

You can update the labels in viewWillAppear:, since that will be called each time the tab is selected.

Daniel Dickison
yes I tried to implement it like this: - (void)viewWillAppear:(BOOL)animated; { number = +1; numberLabel.text = [NSString stringWithFormat:@"%f", number]; }in my viewController but the label keeps reading 1 no matter how many times I change tabs. What am I doing wrong?
CC
got it working now :) thanks... But is there some way to not make it run the first time the viewDidLoad runs? It overwrites my variables :S
CC
If you put this in viewWillAppear, then you don't want to do the same thing in viewDidLoad (since they will both get called). Is that what you meant?
Daniel Dickison
Also, don't you want to do `number++` or `number += 1`? `number = +1` is simply setting number to (positive) 1 every time.
Daniel Dickison
I made it work by setting viewWillAppear to not load the first time. And it only runs if something is changed in the settings... Thanks for your help...
CC