给UIlabel设置不同字体 颜色 下划线
来源:互联网 发布:unity3d鼠标点击物体 编辑:程序博客网 时间:2024/05/20 05:23
UILabel *label = [[UILabelalloc] initWithFrame:CGRectMake(20,20, 520, 100)];
label.textColor = [UIColorgrayColor];
NSMutableAttributedString *str = [[NSMutableAttributedStringalloc] initWithString:@"小明回复:终于可以回家了,太高兴了,哈哈哈哈哈哈。"];
[str addAttribute:NSForegroundColorAttributeName
value:[UIColorblueColor]
range:NSMakeRange(0,5)];
[str addAttribute:NSForegroundColorAttributeName
value:[UIColorredColor]
range:NSMakeRange(6,12)];
[str addAttribute:NSForegroundColorAttributeName
value:[UIColorblackColor]
range:NSMakeRange(2,2)];
//下划线
[str addAttribute:(NSString *)kCTUnderlineStyleAttributeName
value:(id)[NSNumbernumberWithInt:kCTUnderlineStyleSingle]
range:NSMakeRange(0,4)];
[str addAttribute:NSFontAttributeNamevalue:[UIFontfontWithName:@"Arial-BoldItalicMT"size:30.0]range:NSMakeRange(0,5)];
[str addAttribute:NSFontAttributeNamevalue:[UIFontfontWithName:@"HelveticaNeue-Bold"size:30.0]range:NSMakeRange(6,12)];
[str addAttribute:NSFontAttributeNamevalue:[UIFontfontWithName:@"Courier-BoldOblique"size:30.0]range:NSMakeRange(19,6)];
label.attributedText = str;
- 给UIlabel设置不同字体 颜色 下划线
- UILabel,下划线,不同的字体颜色
- UILabel设置不同的字体颜色
- iOS:UILabel设置不同字体颜色
- UILabel设置不同的字体颜色
- Android中如何给TextView添加下划线、设置不同字体和颜色
- UILabel设置不同的字体不同的颜色
- iOS中在UILabel显示不同的字体和颜色,增加下划线
- 根据范围给UILabel设置颜色或字体,行间距
- iOS给UILabel设置缩进、行距、字体颜色
- iOS 在一个UILabel里显示不同的颜色,给文字加下划线
- iOS 在一个UILabel里显示不同的颜色,给文字加下划线
- UILabel设置多种字体、颜色
- UILabel设置多种字体、颜色
- UILabel设置多种字体、颜色
- UILabel设置多种字体、颜色
- UILabel设置多种字体、颜色
- Qt给字体设置下划线
- struts2+spring+hibernate三大框架环境搭建小小总结
- 百度地图API3.1.1版之添加标注物+UI控制+定位
- UVA 10465 Homer Simpson
- Android requires compiler compliance level 5.0 or 6.0. Found '1.7' instead. Please use Android Tool
- [LeetCode] Remove Nth Node From End of List
- 给UIlabel设置不同字体 颜色 下划线
- 第十三周 项目四:数组的排序(1.4选择排序)
- 嗨图SDK,让你的APP”嗨“起来!
- php实现图片加水印
- dubbo的安装和使用
- JPA project Change Event Handler导致工具卡顿解决
- Codeforces Round #277.5 (Div. 2) A
- Productivity Power Tools for vs2010(代码预览工局 插件for vs2010)
- Spring声明式事务配置管理方法