IOS艺术字及简单的图文混排
2015-07-19 17:57
537 查看
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计算文字高度
- IOS之——快速获取苹果设备UDID(插曲)
- ios文章list
- ios文章list
- 28-手势 响应者链 手势识别器
- iOS设计模式-桥接
- iOS应用程序生命周期(前后台切换,应用的各种状态)详解 .
- ios 线程同步
- IOS SEL (@selector) 原理及使用总结(二)
- IOS SEL (@selector) 原理及使用总结(一)
- IOS 解决CG截图功能出现图片翻转的情况
- iOS之新建工程上下出现黑色块
- (七十五)CoreLocation(一)在iOS7和iOS8设备上获取授权
- (七十五)CoreLocation(一)在iOS7和iOS8设备上获取授权
- 苹果开发者证书生成流程
- Nagios监控平台搭建
- ios 自动布局库masonry的技巧分享1
- iOS_21团购_发送请求【点评】数据
- BaseMode
- cell自定义方式二 高度不一致时