core data - How can I change section ordering with NSFetchedResultsController? -


i'm setting nsfetchrequest following sort descriptor:

[sortdescriptors addobject:[nssortdescriptor sortdescriptorwithkey:@"color" ascending:yes]]; 

i'm setting sectionnamekeypath nsfetchedresultscontroller "color" attribute.

the results sorted sections based on color, expect.

it's valid "color" attribute empty string "" objects. grouped in first section, since sort before other names. however, i'd them appear final section, not first section, without affecting search order of remaining objects.

for example, sections might be:

 ""  "green"  "red"  "yellow" 

but i'd sections in order:

 "green"  "red"  "yellow"  "" 

is there way write sort descriptor behavior? i've been unable come myself.

a sort descriptor (sqlite based) core data fetch request can use standard comparator methods , use (persistent) attributes stored in database. non-standard order have add additional attribute entity , use sorting.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -