I am unable to change the UILabel text. The code for the the UILabel inside viewDidLoad is :
startLabel=[[UILabel alloc] initWithFrame:CGRectMake(75, 395, 200, 30)];
startLabel.text=@"Recording Sound ...";
startLabel.backgroundColor=[UIColor clearColor];
startLabel.textColor=[UIColor whiteColor];
startLabel.font=[UIFont boldSystemFontOfSize:17];
[self.view addSubview:startLabel];
Later, if I want to change the label of the text with the following code, its not changing on the app :
startLabel.text=@"Searching Database ...";
or
[startLabel setText:@"Searching Database ..."];
The UILabel is not empty, I printed it out during debugging and it shows :
(gdb) po startLabel
<UILabel: 0x2c1a30; frame = (75 395; 200 30); text = 'Searching Database ...';
clipsToBounds = YES; userInteractionEnabled = NO; layer = <CALayer: 0x2ae8f0>>
So, the text of the label changes inside the UILabel, but its not updated on the screen.
Can anyone kindly let me know what
I am missing here ? Thanks.
Edit 1: I tried performSelectorOnMainThread:
- didnt work for me.
Edit 2: I am using AVFoundation
and ASIHTTP
classes to record sound and upload the recorded file here. Nothing else. Didnt use any thread.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…