I need some help with xcode... I need to show a value on label with [label1 setIntValue: someInt] wait some secs and do again [label1 setIntValue: otherInt]. I tried with sleep() but the ui stucks and only the second int is shown. What I need to do? Thank you very much!
What you need to do is to set up a timer. After setting the first value on the label, use this:
NSTimer* t = [NSTimer scheduledTimerWithTimeInterval:1 target: self selector:@selector(timerEnded) userInfo: nil repeats:NO];
In this case you're waiting 1 second before triggering timerEnded
. So, after this, create the timerEnded
method. This is the method that gets called after 1 second.
-(void)timerEnded{
//set value to label
}