【发布时间】:2009-12-11 14:27:25
【问题描述】:
我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. Ive 尝试了 -(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. 级别视图并返回到根视图时,值应该会改变。
【问题讨论】:
标签: iphone objective-c text singleton label