开发者

Iphone: label text udates value but does not show in view

开发者 https://www.devze.com 2022-12-14 06:13 出处:网络
Im 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 i

Im 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 tried the code both in -(void)viewDidLoad and -(void)viewWillAppear:(BOOL)animated, but with the same result.. Any ideas?

Here are my code:

- (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];

}

Edit: Oh, and I should mention that I´ve implemented a navigation controller, and the value should change when popping a 2. level view off the开发者_开发知识库 stack and going back to the root view.


Ensure your statusText outlet is properly connected to your IB object.

0

精彩评论

暂无评论...
验证码 换一张
取 消