按字母顺序划分的 UITableView、NSSortPredicate 与数组数组?
我有一系列简单的对象。我希望在按字母顺序排序的分段表视图中显示这些内容,第一部分是“A”,第二部分是“B”等。该表的数据源,即简单数组,可能会经常更新(每个部分都相同)十分钟)。
我试图弄清楚是否最好有一个二维数组,每个子数组对应于字母表中的一个字符/填充一个部分。或者使用谓词来获取每个部分和部分的对象。按字母顺序排序?
我倾向于多维数组方法,因为它可能比搜索和搜索消耗更少的资源。对每个部分进行排序谓词计算?
I have an array of simple objects. I wish to display these in a sectioned table view sorted alphabetically, the first section being "A", the second being "B", etc. The data-source of this table, i.e. the simple array, may be updated frequently (same every ten minutes).
I'm trying to figure out if its better to have an two dimensional array with each sub-array corresponding to a character in the alphabet / populating a section. Or use predicates to get the objects for each section & sort them alphabetically?
I'm leaning towards the multi-dimensional array approach as it might be less resource intensive than doing a search & sort predicate computation for each section?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看
UILocalizedIndexedCollation
< /a> 类及其相关示例代码。它是专门为此目的而设计的。您可能对这个文档也是如此。
Look at the
UILocalizedIndexedCollation
class and its associated sample codes. It is designed especially for this purpose.You may be interested in this doc too.