Label后加小图标

NSMutableAttributedString*attri = [[NSMutableAttributedStringalloc]initWithString:[NSStringstringWithFormat:@"%@ ",fields.title]];

// 添加表情

NSTextAttachment*attch = [[NSTextAttachmentalloc]init];

// 表情图片

attch.image= [UIImageimageNamed:@"newTopList"];

// 设置图片大小

attch.bounds= CGRectMake(10,0,25,14);

if([fields.isnewboolValue]) {

// 创建带有图片的富文本

NSAttributedString*strings = [NSAttributedStringattributedStringWithAttachment:attch];

[attriappendAttributedString:strings];

}

// 用label的attributedText属性来使用富文本

_titleLabel.attributedText= attri;

你可能感兴趣的:(Label后加小图标)