NSTextAttachment

NSTextAttachment: 使用图片创建一个NSAttributedString

UIImage *image = [UIImage imageNamed:@"image_name"];
NSTextAttachment *attachment = [[NSTextAttachment alloc] init];
attachment.image = image;
NSAttributedString *attrStr = [NSAttributedString attributedStringWithAttachment:attachment];
分享到 评论