ios - FetchResultsController sorting issue -
i have nsfetchresultscontroller initialised nssortdescriptor sorts according localizedcaseinsensitivecompare: method.
entities sorted on last name, of them don't specify last name , hence, char 170 (in ascii) set last name (don't ask me why, source code done way , rather don't change it). when sorted, these persons "without last name" displayed @ top of table view. them @ end of it.
seems not possible use specific nssortdescriptor in case (i'm using frc), options here ?
[edit] comparator blocks or custom comparator methods won't work nsfetchresultscontroller
your options limited sort descriptor needs able work sqlite data store.
you should edit data model have attribute can sort on. how calculate value you, attribute can't temporary. suggest either:
- implement
willsaveinnsmanagedobjectsubclass create / update sort data - or, make sort data dependent key (using
kvo, again innsmanagedobjectsubclass)
your sort data simple as:
self.sortvalue = (self.lastname == 170 in ascii ? @"zzzzzzzzzzzzzzz" : lastname)
Comments
Post a Comment