码迷,mamicode.com
首页 > 移动开发 > 详细

IOS艺术字及简单的图文混排

时间:2015-07-19 19:25:53      阅读:120      评论:0      收藏:0      [点我收藏+]

标签:

        NSString* alertText = [NSString stringWithFormat:@" 以下%d节课程(总课酬¥%.02lf)家长们尚未结课并评价,请尽快联系家长,否则无法获取课酬。",self.courseNum,self.totalPrice];
        NSMutableAttributedString* alertString = [[NSMutableAttributedString alloc]initWithString:alertText];
        NSRange totalRange = NSMakeRange(0, alertString.length);
        [alertString addAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:16.0],NSForegroundColorAttributeName:[UIColor themePinkColor]} range:totalRange];
    //文字前边加一个图标 NSTextAttachment
* textAttachment = [[NSTextAttachment alloc]initWithData:nil ofType:nil]; UIImage* alertIcon = [ UIImage imageNamed:@"lesson_icon26"]; textAttachment.image = alertIcon; textAttachment.bounds = CGRectMake(0,-5, kAlertIconHeight, kAlertIconHeight); [alertString insertAttributedString:[NSAttributedString attributedStringWithAttachment:textAttachment] atIndex:0]; self.alertLabel.attributedText = alertString;

 

IOS艺术字及简单的图文混排

标签:

原文地址:http://www.cnblogs.com/guoxiaoqian/p/4659012.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!