Order of sections produced by NSFetchedResultsController?

≯℡__Kan透↙ 提交于 2020-01-07 07:16:24

问题


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:


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



来源:https://stackoverflow.com/questions/28465031/order-of-sections-produced-by-nsfetchedresultscontroller

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!