Skip to content

Commit

Permalink
Fixing a bug where the completion block is being called too early.
Browse files Browse the repository at this point in the history
  • Loading branch information
onekiloparsec committed Aug 31, 2013
1 parent 6220e4e commit 043d8e3
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions UICountingLabel.m
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,6 @@ -(void)updateValue:(NSTimer*)timer
{
[timer invalidate];
self.progress = self.totalTime;
if(self.completionBlock != nil)
{
self.completionBlock();
self.completionBlock = nil;
}
}

float percent = self.progress / self.totalTime;
Expand All @@ -176,6 +171,12 @@ -(void)updateValue:(NSTimer*)timer
self.text = [NSString stringWithFormat:self.format,value];
}
}

if(self.progress == self.totalTime && self.completionBlock != nil)
{
self.completionBlock();
self.completionBlock = nil;
}
}

@end

0 comments on commit 043d8e3

Please sign in to comment.