首页 > 其他 > 详细

NSAttributedString

时间:2015-09-25 18:49:25      阅读:204      评论:0      收藏:0      [点我收藏+]
        1.//加载图片
        NSTextAttachment *attch = [[NSTextAttachment alloc] init];
        attch.image = [UIImage imageNamed:emotion.png];
        CGFloat attchWH = self.font.lineHeight;
        attch.bounds = CGRectMake(0, -4, attchWH, attchWH);
        //根据附件创建一个属性文字
        NSAttributedString *imageStr = [NSAttributedString attributedStringWithAttachment:attch];
        
        2.//拼接文字
        [attributedText appendAttributedString:self.attributedText];
        
        3.//NSAttributedString转化为NSString
        NSString *str = attributedText.string


NSAttributedString

原文:http://my.oschina.net/u/2346786/blog/511306

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