UILable换行底部增加图片
2016-01-25 13:38
465 查看
UILabel *lable = [[UILabel alloc] initWithFrame:CGRectMake(0, 200, Width, 100)];
lable.numberOfLines=0;
[self.view addSubview:lable];
NSAttributedString *subStr1 = [[NSAttributedString alloc] initWithString:@"好傻好傻好傻好撒婚纱和撒谎莎婚纱和傻好傻好撒婚纱和撒谎莎婚纱和傻好傻好撒婚纱和撒谎莎婚纱和傻好傻好撒婚纱和撒谎莎婚纱和撒谎莎莎婚纱"
attributes:@{NSForegroundColorAttributeName:[UIColor redColor],
NSFontAttributeName:[UIFont systemFontOfSize:15]
}];
NSAttributedString *subStr2 = [[NSAttributedString alloc] initWithString:@"哈哈哈哈哈哈哈"
attributes:@{NSForegroundColorAttributeName:[UIColor blueColor],
NSFontAttributeName:[UIFont systemFontOfSize:15]
}];
NSTextAttachment *attch = [[NSTextAttachment alloc] init];
attch.image=[UIImage imageNamed:@"error"];
attch.bounds=CGRectMake(0, -3, [UIFont systemFontOfSize:15].lineHeight, [UIFont systemFontOfSize:15].lineHeight);
NSAttributedString *subStr3 = [NSAttributedString attributedStringWithAttachment:attch];
NSMutableAttributedString *attrText = [[NSMutableAttributedString alloc] init];
[attrText appendAttributedString:subStr1];
[attrText appendAttributedString:subStr2];
[attrText appendAttributedString:subStr3];
lable.attributedText=attrText;
相关文章推荐
- 兔子--Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK
- 关于ueditor报错问题
- poj 3080 Blue Jeans KMP模式匹配
- iOS之浅谈纯代码控制UIViewController视图控制器跳转界面的几种方法
- cygwin gnu-make4.1 ndk build
- Delaunay Triangulation, Divide And Conquer Method
- Leetcode 225. Implement Stack using Queues
- 是 PROTEUS 还是 PROTUES ?
- UIPickView与UIDatePicker的使用
- iOS UICollectionView之三(基本用法)
- UITableViewcell分割线满格显示
- IOS8 新增的UIVisualEffectView 使用
- Ligerui表格基本操作(五)
- libgdx 中UI布局之Table
- uva 12207 - That is Your Queue
- 根据 字数 确定 UI控件高度
- Ligerui表格基本操作(四)
- Mac开发 - 使用CCMenu和CCMenuItem添加菜单、右击菜单、Dock菜单
- no persistent classes found for query class: FROM com.vrv.paw.domain.User
- UE4 Lightmass 全局光照