// 添加表情
NSTextAttachment *attch = [[NSTextAttachment alloc] init];
// 表情图片
attch.image = [UIImage imageNamed:@"图片"];
// 设置图片大小
attch.bounds = CGRectMake(0, 0, 32, 32);
// 创建带有图片的富文本
NSAttributedString *string = [NSAttributedString attributedStringWithAttachment:attch];
[attri appendAttributedString:string];
// 用label的attributedText属性来使用富文本
self.textLabel.attributedText = attri;
图文结合
最新推荐文章于 2022-12-19 09:37:34 发布