YYLabel与UILabel对表情的支持
YYLabel只支持YYTextAttachment,不支持系统默认的NSTextAttachment
// NSTextAttachment转换成YYTextAttachment
[mutableAttributeString enumerateAttribute:NSAttachmentAttributeName inRange:NSMakeRange(0, mutableAttributeString.length) options:0 usingBlock:^(id _Nullable value, NSRange range, BOOL * _Nonnull stop) {
if ([value isKindOfClass:NSTextAttachment.class]) {
NSTextAttachment *attachment = (NSTextAttachment *)value;
NSAttributedString *replaceAttributeString = [NSMutableAttributedString yy_attachmentStringWithContent:attachment.image contentMode:UIViewContentModeScaleAspectFit attachmentSize:attachment.bounds.size alignToFont:font alignment:YYTextVerticalAlignmentCenter];
[mutableAttributeString replaceCharactersInRange:range withAttributedString:replaceAttributeString];
}
}];
YYLabel高亮显示、点击事件
[mutableAttributeStrin