NSAttributedString字符串属性
来源:互联网 发布:药品网络市场监管 编辑:程序博客网 时间:2024/05/31 06:24
1. 初始化
initWithString:
例子:
NSMutableAttributedString * mutableStr = [[NSMutableAttributedString alloc]initWithString:str];
2. 添加属性
2.1 添加单个属性
addAttribute: value: range:例子:
[mutableStr addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:NSMakeRange(1, 2)];
2.2 添加多个属性
addAttributes:<#(nonnull NSDictionary<NSString *,id> *)#> range:<#(NSRange)#>例子:
NSDictionary * arributes = @{NSFontAttributeName:[UIFont systemFontOfSize:18], NSForegroundColorAttributeName:[UIColor whiteColor]}; [mutableStr addAttributes:arributes range:NSMakeRange(1, 2)];
0 0
- NSAttributedString 详解(属性字符串)
- NSAttributedString字符串属性
- iOS-属性字符串NSAttributedString
- iOS NSAttributedString(属性字符串)
- 属性字符串NSAttributedString简易教程
- Objective-C属性字符串NSAttributedString
- 带属性的字符串 NSMutableAttributedString/NSAttributedString
- 带属性的字符串 NSMutableAttributedString/NSAttributedString
- iOS - NSAttributedString字符串属性详解
- NSAttributedString 属性
- NSAttributedString属性
- UILabel的一些常用属性、NSAttributedString属性字符串
- UIKit 带属性的字符串 NSAttributedString、NSMutableAttributedString、NSTextStorge(未完成)
- NSAttributedString的属性
- NSAttributedstring的属性
- 字符属性NSAttributedString
- NSAttributedString属性详解
- NSAttributedString属性解析
- About CellCLI Object Commands
- xcode7 真机调试ios7 出错(there was an internal api error)
- eclipse弹出:An internal error occurred during: "JavaScript translation for 这个错误
- android监听联系人变化的方法
- Android Studio 日常问题处理
- NSAttributedString字符串属性
- Java正则表达式的语法与示例
- 已知圆上三点坐标求圆心
- 1105. Spiral Matrix (25) / 1050. 螺旋矩阵(25) 考察代码优化,而非算法
- 统计回文字符串
- ScaleGestureDetector接收双击手势问题
- 使用geohash实现经纬度范围内搜索
- Android 四大大图片缓存(Imageloader,Picasso,Glide,Fresco)原理、特性对比
- SQL Server 2008查询IP地址方法