浏览代码

remove discontinuous attributes when called `setText:`

ibireme 9 年之前
父节点
当前提交
1263dcfc5e
共有 1 个文件被更改,包括 1 次插入0 次删除
  1. 1 0
      YYText/YYLabel.m

+ 1 - 0
YYText/YYLabel.m

@@ -529,6 +529,7 @@ static dispatch_queue_t YYLabelGetReleaseQueue() {
     _text = text.copy;
     BOOL needAddAttributes = _innerText.length == 0 && text.length > 0;
     [_innerText replaceCharactersInRange:NSMakeRange(0, _innerText.length) withString:text ? text : @""];
+    [_innerText yy_removeDiscontinuousAttributesInRange:NSMakeRange(0, _innerText.length)];
     if (needAddAttributes) {
         _innerText.yy_font = _font ? _font : [self _defaultFont];
         _innerText.yy_color = _textColor;