So I have a UITabBarController with 4 views underneath it.
One of those ViewControllers (called optionsViewController) that has an IBOutlet LABEL for a message. I'm using that as a sort of debug message on screen that I can update.
The TabBarController makes a call into the optionsViewController function called UpdateDeviceStatus
When the app launches, the STATUS label is set to "BLAH" in the viewDidLoad function.
But when the TabBarController calls UpdateDeviceStatus, the label does not update.
@synthesize device_firmware_version, device_status;
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
self.device_status.text = @"BLAH";
}
- (void) UpdateDeviceStatus:(NSString *)status
{
NSLog(@"Updating Status: %@", status);
self.device_status.text = status;
}
The Label is connected in the Storyboard and the connection in the header file is (nonatomic, retain)
@property (nonatomic, retain) IBOutlet UILabel *device_status;
If we look at the LOG file, the variable status
is correct. But the LABEL on screen does not update. I set breakpoints, it is only going into viewDidLoad once and it is going into UpdateDeviceStatus once.
I'm missing something obvious, stackoverflow....please help.
I guess "self.device_status" is nil.
Set breakpoints on this line.
self.device_status.text = status;
And check if self.device_status is nil. You can input "po self.device_status" and press "Enter" on Xcode's console area.
The most likely reason is UpdateDeviceStatus is called before the optionsViewController load.