Order of sections produced by NSFetchedResultsCont

2019-09-10 16:31发布

Does a NSFetchedResultsController assign values for the attribute identified by sectionNameKeyPath to sections always in ascending order?

For instance if my sectionNameKeyPath were an (optional) boolean attribute with values @(YES), @(NO), @(YES), would the first section receive one row (because NO corresponds to 0) and the second section receive two (because YES corresponds to 1)?

So is that the case and if that is, can one change the order (without introducing another attribute that "inverses" the first)?

1条回答
The star\"
2楼-- · 2019-09-10 17:22

sortDescriptors is what actually sorts the objects. sectionNameKeyPath simply describes where the section borders should be given that sorting (one section per unique value).

查看更多
登录 后发表回答