Skip to content

Commit

Permalink
remove discontinuous attributes when called setText:
Browse files Browse the repository at this point in the history
  • Loading branch information
ibireme committed Jan 7, 2016
1 parent 2600235 commit 87b2565
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions YYKit/Text/YYLabel.m
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,7 @@ - (void)setText:(NSString *)text {
_text = text.copy;
BOOL needAddAttributes = _innerText.length == 0 && text.length > 0;
[_innerText replaceCharactersInRange:NSMakeRange(0, _innerText.length) withString:text ? text : @""];
[_innerText removeDiscontinuousAttributesInRange:NSMakeRange(0, _innerText.length)];
if (needAddAttributes) {
_innerText.font = _font ? _font : [self _defaultFont];
_innerText.color = _textColor;
Expand Down

0 comments on commit 87b2565

Please sign in to comment.