请帮忙。谢谢。
当我用NSAttributedString替换字符时发生了这种情况,该NSAttributedString不包含字符,但带有textAttachment。
for (int i = (int)imageAndRangeDicArray.count - 1; i >= 0; i--)
{
NSValue *rangeValue = imageAndRangeDicArray[i][@"range"];
NSRange range = [rangeValue rangeValue];
DLog(@"%@",string);
DLog(@"location:%lu,length:%lu",(unsigned long)range.location,(unsigned long)range.length);
[emtionString replaceCharactersInRange:range withAttributedString:imageAndRangeDicArray[i][@"image"]];
}
这个字符串是已首发[亲亲]
范围是位置:3,长度:4
它不在范围之外。
它在像这样的字符串中工作正常
错了,是楚商杂志[呲牙] [呲牙]
位置:8,长度:4