开发者

Sorting NSFetchedResultsController's sections array

开发者 https://www.devze.com 2023-03-17 02:23 出处:网络
Is there a way to sort the sections property of NSFetchedResultsController? Let\'s say i don\'t want m开发者_开发百科y sections to be sorted alphabetically ascending, but descending. Or maybe not even

Is there a way to sort the sections property of NSFetchedResultsController? Let's say i don't want m开发者_开发百科y sections to be sorted alphabetically ascending, but descending. Or maybe not even alphabetically but ascending by the number of rows in a section.

I can imagine that sorting the array directly isn't a good idea, since NSFetchedResultsController created and filled it for me..


"1) use a transient property that joins the property to sort by and the property that will be displayed as the title and specified in the sectionNameKeyPath and

2) then use the UITableViewDelegate titleForHeaderSection to extract the name from the value."

more here: http://machine501.com/blog/2011/04/26/uitableview-section-sorting-a-hack/

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号