Based on your requirement you need to use NSTimer
for update your label progress
Step 1: Create 2 variable in your @interface
class
@interface BUViewController: UIViewController {
NSTimer *timerCount;
int progress;
}
Step 2: Start Timer in your viewDidLoad()
with progress value 0
.
progress = 0;
timerCount = [NSTimer timerWithTimeInterval:0.5 target:self selector:@selector(updateLabel) userInfo:nil repeats:YES];
Step 3: create method with timer update label text an check progress value in it and stop timer while its reach 100
.
-(void)updateLable{
if (progress<100) {
lblProgress.text = [NSString stringWithFormat:@"%d",progress];
progress++;
}else{
[timerCount invalidate];
timerCount = nil;
}
}
Hope this will help you to achieve your expected output.