Skip to content

Commit

Permalink
abstracted execution of text`s completion block
Browse files Browse the repository at this point in the history
  • Loading branch information
TomKnig committed Nov 23, 2014
1 parent 8097968 commit d2f17bb
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions Classes/TOMSMorphingLabel.m
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,7 @@ - (void)setText:(NSString*) text withCompletionBlock:(void (^)(void))block{
}
} else {
super.text = text;
if (_setTextCompletionBlock != nil) {
_setTextCompletionBlock();
_setTextCompletionBlock = nil;
}
[self textDidChange];
}
}

Expand Down Expand Up @@ -436,18 +433,22 @@ - (void)endMorphing
self.animating = NO;
if (self.nextText) {
[self beginMorphing];
}
else{
if(_setTextCompletionBlock != nil){
_setTextCompletionBlock();
_setTextCompletionBlock = nil;
}
} else {
[self textDidChange];
}
}
});
});
}

- (void)textDidChange
{
if(_setTextCompletionBlock != nil){
_setTextCompletionBlock();
_setTextCompletionBlock = nil;
}
}

- (void)tickMorphing
{
@synchronized (self) {
Expand Down

0 comments on commit d2f17bb

Please sign in to comment.