How can I make a counter from 0 to 10 choosing the delay?
you need to use NSTimer
,
Check the below code as reference.
- (void) startCounter {
counterCount = 0;
[NSTimer scheduledTimerWithInterval:0.09f target:self selector:@selector(showElapsedTime:) userInfo:nil repeats:YES];
}
showElapsedTime
will be called after delay, you provide.
-(void) showElapsedTime: (NSTimer *) timer {
counterCount++;
if(counterCount == 10)
{
[timer invalidate];
}
// Write your code here
}