首页 > 其他 > 详细

UILabel 添加图片

时间:2016-03-26 18:34:05      阅读:162      评论:0      收藏:0      [点我收藏+]
//设置显示图片
        NSMutableAttributedString * cellAttributeStr = [[NSMutableAttributedString alloc]initWithString:[self.textArr objectAtIndex:indexPath.row]];
        NSTextAttachment * attachMent = [[NSTextAttachment alloc]initWithData:nil ofType:nil];
        UIImage * image = [UIImage imageNamed:[self.imageArr objectAtIndex:indexPath.row]];
        attachMent.image = image;
        attachMent.bounds = CGRectMake(0, 0, 9, 9);
        NSAttributedString * imageAttributeStr = [NSAttributedString attributedStringWithAttachment:attachMent];
        [cellAttributeStr insertAttributedString:imageAttributeStr atIndex:0];
        cell.textLbl.attributedText = cellAttributeStr;

  在后面如何设置距离text的距离,还不知道。

UILabel 添加图片

原文:http://www.cnblogs.com/tanglimei/p/5323321.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!