解决方案:
NSMutableAttributedString *mutableAttributedString = [[NSMutableAttributedStringalloc] init];
NSMutableAttributedString *atr = [[NSMutableAttributedStringalloc]initWithString:@"\uFFFC "];
NSTextAttachment *attach = [[NSTextAttachmentalloc]init];
attach.image = image;
attach.bounds =CGRectMake(0, -2,titleFontSize, titleFontSize);
[atr setAttributes:@{NSAttachmentAttributeName:attach}range:NSMakeRange(0, atr.length)];
[mutableAttributedString appendAttributedString:atr];
\uFFC为对象占位符
本文介绍如何在iOS应用中使用NSAttributedString和NSTextAttachment将图片插入到文本中,并调整其位置及大小。
3902

被折叠的 条评论
为什么被折叠?



