NSAttributedString的各种设置
2015-09-23 18:41
190 查看
创建一个NSAttributedString的对象
NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:@"你要填入的字符串"];
设置[b]NSAttributedString的颜色[/b][str addAttribute:NSForegroundColorAttributeName value:[UIColor blueColor] range:[string
rangeOfString:@"你所要设置颜色的字段,也可以直接写range,我这里这样用方便"]];
设置NSAttributedString的字号
[str addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:16] range:[string rangeOfString:@"你所要设置大小的字段,也可以直接写range,我这里这样用方便"]];
相关文章推荐
- xen虚拟化实战系列(八)之xen虚拟机开机自启动配置
- [Leetcode]Gray Code
- centos 6.x安装gitlab
- IE input file隐藏不能上传文件解决方法(转载)
- 网络字节序和主机字节序
- eclipse无法识别手机
- JAVA中重写equals()方法为什么要重写hashcode()方法
- 递归(三)
- Windows 删除 .svn标志
- /usr/local/php-fcgi/sbin/php-fpm start启动服务报错
- 线性表
- struts2 result type= redirect redirectAction chain dispatcher等类型
- The specified child already has a parent. You must call removeView() on the child's parent first.
- "This app is not allowed to query for scheme ***"
- jquery中onclick事件处理(转载)
- LUA string库详解
- hadoop 配置项的调优
- Oracle--工作小结
- 鸟哥的Linux私房菜10.16 vim程序编辑器
- hihoCoder 1236 Scores 解题报告(bitset + 分段暴力)