ios NSMutableAttributedString 实现富文本(不同颜色字体、下划线等)
来源:互联网 发布:淘宝零食店铺知乎 编辑:程序博客网 时间:2024/05/21 19:21
效果图:
- (void)setLabText:(NSString *)text{ NSMutableAttributedString *attributedStr = [[NSMutableAttributedString alloc] initWithString:text]; [attributedStr addAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:16],NSForegroundColorAttributeName:COLOR_252525} range:NSMakeRange(0, 4)]; [attributedStr addAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:18],NSForegroundColorAttributeName:COLOR_0093FF} range:NSMakeRange(4, text.length-5)]; [attributedStr addAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:12],NSForegroundColorAttributeName:COLOR_999999} range:NSMakeRange(text.length-2, 2)]; _Lab.attributedText = attributedStr;}
0 0
- ios NSMutableAttributedString 实现富文本(不同颜色字体、下划线等)
- iOS - NSMutableAttributedString 实现富文本(不同颜色字体、下划线等)
- iOS NSMutableAttributedString 实现富文本(不同颜色字体、下划线等)
- 使用NSMutableAttributedString 实现富文本(不同颜色字体、下划线等)
- iOS使用NSMutableAttributedString 实现富文本(不同颜色字体、下划线等)
- iOS使用NSMutableAttributedString 实现富文本(不同颜色字体、下划线等)
- iOS使用NSMutableAttributedString 实现富文本(不同颜色字体、下划线等)
- iOS使用NSMutableAttributedString 实现富文本(不同颜色字体、下划线等)
- iOS使用NSMutableAttributedString 实现富文本(不同颜色字体、下划线等)
- 151202iOS使用NSMutableAttributedString 实现富文本(不同颜色字体、下划线等)
- iOS使用NSMutableAttributedString 实现富文本(不同颜色字体、下划线等)
- iOS使用NSMutableAttributedString 实现富文本(不同颜色字体、下划线等)
- iOS使用NSMutableAttributedString 实现富文本(不同颜色字体、下划线等)
- iOS使用NSMutableAttributedString 实现富文本(不同颜色字体、下划线等)
- iOS使用NSMutableAttributedString 实现富文本(不同颜色字体、下划线等)
- iOS使用NSMutableAttributedString 实现富文本(不同颜色字体、下划线等)
- iOS使用NSMutableAttributedString 实现富文本(不同颜色字体、下划线等)
- iOS使用NSMutableAttributedString 实现富文本(不同颜色字体、下划线等)
- Junit4测试报错:java.lang.IllegalStateException: Failed to load ApplicationContext
- php 时间处理常用函数
- Hbase入门
- 6步学会VS封装DLL
- keil4升级到keil5出现..\USER\stm32f10x.h(298): error: #67: expected a "}"错误
- ios NSMutableAttributedString 实现富文本(不同颜色字体、下划线等)
- selenium+junit4 参数化测试
- WebService学习——使用CXF编写WebService客户端
- 博客写的时候很多内容由于图片问题会省略
- spring 框架学习(四) 注解
- webjs与native交互SDK(android,ios通用)
- GPU加速的QT5.6.0交叉编译到4412
- lenovo E431 安装Windows7 方法
- Count Numbers with Unique Digits