Skip to content

Commit

Permalink
Merge pull request #4 from onekiloparsec/master
Browse files Browse the repository at this point in the history
ARC by default + completionBlock bugfix
  • Loading branch information
Tim Gostony committed Oct 5, 2013
2 parents 6307ef1 + 043d8e3 commit 70a589f
Showing 1 changed file with 9 additions and 17 deletions.
26 changes: 9 additions & 17 deletions UICountingLabel.m
Original file line number Diff line number Diff line change
Expand Up @@ -118,16 +118,16 @@ -(void)countFrom:(float)startValue to:(float)endValue withDuration:(NSTimeInterv
switch(self.method)
{
case UILabelCountingMethodLinear:
self.counter = [[[UILabelCounterLinear alloc] init] autorelease];
self.counter = [[UILabelCounterLinear alloc] init];
break;
case UILabelCountingMethodEaseIn:
self.counter = [[[UILabelCounterEaseIn alloc] init] autorelease];
self.counter = [[UILabelCounterEaseIn alloc] init];
break;
case UILabelCountingMethodEaseOut:
self.counter = [[[UILabelCounterEaseOut alloc] init] autorelease];
self.counter = [[UILabelCounterEaseOut alloc] init];
break;
case UILabelCountingMethodEaseInOut:
self.counter = [[[UILabelCounterEaseInOut alloc] init] autorelease];
self.counter = [[UILabelCounterEaseInOut alloc] init];
break;
}

Expand All @@ -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,15 +171,12 @@ -(void)updateValue:(NSTimer*)timer
self.text = [NSString stringWithFormat:self.format,value];
}
}
}

-(void)dealloc
{
[_completionBlock release];
[_formatBlock release];
[_counter release];
[_format release];
[super dealloc];
if(self.progress == self.totalTime && self.completionBlock != nil)
{
self.completionBlock();
self.completionBlock = nil;
}
}

@end

0 comments on commit 70a589f

Please sign in to comment.