NSAttributedString分类-计算富文本高度
来源:互联网 发布:无损音乐软件 编辑:程序博客网 时间:2024/05/21 04:20
- (id)safeObjectAtIndexedSubscript:(NSUInteger)index { if (index >= self.count) { return nil; } else { return [selfobjectAtIndex:index]; } } - (id)safeObjectAtIndex:(NSUInteger)index { if (index >= self.count) { return nil; } else { return [selfobjectAtIndex:index]; } } + (instancetype)safeArrayWithObject:(id)object { if (object == nil) { return [selfarray]; } else { return [selfarrayWithObject:object]; } } - (NSArray *)safeSubarrayWithRange:(NSRange)range { NSUInteger location = range.location; NSUInteger length = range.length; if (location + length > self.count) { //超过了边界,就获取从loction开始所有的item if ((location + length) > self.count) { length = (self.count - location); return [selfsafeSubarrayWithRange:NSMakeRange(location, length)]; } return nil; } else { return [selfsubarrayWithRange:range]; } } - (NSUInteger)safeIndexOfObject:(id)anObject { if (anObject == nil) { return NSNotFound; } else { return [selfindexOfObject:anObject]; } } - (NSString *)toJSONStringForArray { NSData *paramsJSONData = [NSJSONSerializationdataWithJSONObject:selfoptions:0error:nil]; return [[NSStringalloc] initWithData:paramsJSONData encoding:NSUTF8StringEncoding]; }
阅读全文
0 0
- NSAttributedString分类-计算富文本高度
- iOS-[NSAttributedString]设置富文本和计算富文本高度
- iOS_富文本(NSAttributedString)
- NSAttributedString 富文本详解
- NSAttributedString(富文本)用法
- iOS富文本(NSAttributedString)
- iOS 动态计算Label富文本高度
- 富文本NSAttributedString与NSMutableAttributedString
- NSMutableAttributedString/NSAttributedString 富文本设置
- 富文本,NSAttributedString 与 coreText
- iOS开发-NSAttributedString富文本
- 常用富文本NSAttributedString浅析
- iOS之富文本NSAttributedString
- 自定义分类计算文本高度和宽度
- iOS NSMutableAttributedString/NSAttributedString 富文本设置
- iOS NSMutableAttributedString/NSAttributedString 富文本设置
- iOS NSMutableAttributedString/NSAttributedString 富文本设置
- 富文本 NSAttributedString一些常量属性解释
- Mac OS无法进入系统/数据备份/重装系统方法步骤
- Spark打印每个split及其对应文件
- 初识junit4
- RecylerView的使用
- 天天和不可描述
- NSAttributedString分类-计算富文本高度
- zip格式文件伪加密
- gcc命令
- 进程间的通信方式?
- 洛谷p1330 封锁阳光大学-二分图染色
- 教你怎么编写高效的JSON工具类
- 【Spring】专业术语了解(二)
- 如何科学地蹭热点:用python爬虫获取热门微博评论并进行情感分析
- 用 JavaScript 实现发布/订阅模式