I have a UILabel that informs the user how much time is left in a round of my game. Here's the code:
It normally displays and updates properly, except when a UIScrollView is scrolling. I suspect the action of scrolling is somehow blocking the main thread, but I'm not really sure as I don't have a particularly firm grasp on understanding how threading works.
Could someone offer me a solution for how to make my countdown timer to continue updating even when scrolling?
Code:
startDate = [[NSDate alloc] init];
updateClockTimer = [NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(updateClock) userInfo:nil repeats:YES];
Code:
- (void)updateClock
{
double totalSecs = [startDate timeIntervalSinceNow] + SECS_PER_ROUND;
int mins = totalSecs/60;
int secs = (int)totalSecs%60;
int deca = (int)(totalSecs * 10)%10;
rightScore.text = [NSString stringWithFormat:@"%i:%.2i.%i", mins, secs, deca];
}
It normally displays and updates properly, except when a UIScrollView is scrolling. I suspect the action of scrolling is somehow blocking the main thread, but I'm not really sure as I don't have a particularly firm grasp on understanding how threading works.
Could someone offer me a solution for how to make my countdown timer to continue updating even when scrolling?
Last edited: