iOS UILocalizedIndexedCollation
来源:互联网 发布:淘宝没有爱奇艺卖了 编辑:程序博客网 时间:2024/05/01 02:49
UILocalizedIndexedCollation 是一个帮助我们组织列表数据的类,它能够根据地区来生成与之对应区域索引标题。不需要直接创建它的对象,我们可以通过 UILocalizedIndexedCollation +currentCollation 获得一个对应当前地区的单例对象。
UILocalizedIndexedCollation 的首要任务就是决定对于当前地区区域索引标题应该是什么,我们可以通过 sectionIndexTitles 属性来获得它们。
- (void)setObjects:(NSArray *)objects{ SEL selector = @selector(localizedTitle); UILocalizedIndexedCollation *collation = [UILocalizedIndexedCollation currentCollation]; NSInteger sectionCount = [[collation sectionTitles] count]; NSMutableArray *mutableSections = [NSMutableArray array]; for (NSUInteger idx = 0; idx < sectionCount; idx++) { [mutableSections addObject:[NSMutableArray array]]; } [objects enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { NSInteger sectionNum = [collation sectionForObject:obj collationStringSelector:selector]; [mutableSections[sectionNum] addObject:obj]; }]; for (NSUInteger idx = 0; idx < sectionCount; idx++) { NSArray *objectsForSection = [mutableSections objectAtIndex:idx]; [mutableSections replaceObjectAtIndex:idx withObject:[[UILocalizedIndexedCollation currentCollation] sortedArrayFromArray:objectsForSection collationStringSelector:selector]]; } // other handle}
参考链接:http://nshipster.cn/uilocalizedindexedcollation/
0 0
- iOS UILocalizedIndexedCollation
- UILocalizedIndexedCollation ios首字母排列
- iOS UILocalizedIndexedCollation排序神器
- UILocalizedIndexedCollation
- iOS开发------通讯录分组排序(UILocalizedIndexedCollation)
- IOS开发(52)之UITableView索引搜索之UILocalizedIndexedCollation
- iOS 使用UILocalizedIndexedCollation实现通讯录样式的索引
- UILocalizedIndexedCollation 使用
- 13.UILocalizedIndexedCollation
- UILocalizedIndexedCollation简介
- iOS仿微信联系人界面中联系人按姓名首字母分类UILocalizedIndexedCollation
- UILocalizedIndexedCollation 的浅分析
- UILocalizedIndexedCollation 的浅分析
- 通讯录分组排序(UILocalizedIndexedCollation)
- 20160830UILocalizedIndexedCollation的使用
- UILocalizedIndexedCollation的使用
- 关于使用UILocalizedIndexedCollation 实现tableview的边索引
- 本地化下按首字母分组排序的神器——UILocalizedIndexedCollation
- android 本地数据存贮之sharedpreference
- Servlet获取表单数据和路径跳转。
- Log4j.properties配置详解
- JUNIT(suite组合测试)
- 我的第一个REST客户端程序!
- iOS UILocalizedIndexedCollation
- "浪潮杯"第六届ACM山东省省赛山科场总结
- JQuery插件写法练习Demo
- 【C++】动态开辟二维数组
- linux Mint 安装博通bcm4312无线网卡驱动
- SOA和云计算的关系
- C语言程序设计进阶 翁恺 第4周编程练习
- 发送短信
- DTCoretext使用