我m working on a part of code where a label text should change value after getting a new value from a singleton class. Seems simple enough, and after testing the value it actually changes aswell, but its not updated in the view. In the view it stays the same as before. I
尝试了 - (void)viewDidLoad和-(void)viewWillAppear:(BOOL)animated
中的代码,但结果相同..有什么想法吗?
以下是我的代码:
- (void)viewDidLoad {
//get the new status value
sharedBarCodeValue = [BarcodeValues sharedBarCodeValues];
if([[sharedBarCodeValue storeBarCodeValue] isEqualToString:@"123456"])
{
[statusText setText:@"This is a new status text"];
}
//for testing, output status text
NSLog(@"status: %@", statusText.text);
[super viewDidLoad];
}
编辑:哦,我应该提一下,我已经实现了一个导航控制器,当从堆栈中弹出2.级视图并返回到根视图时,该值应该会改变。
答案 0 :(得分:2)
确保您的statusText插座已正确连接到您的IB对象。