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:

  1. implement willsave in nsmanagedobject subclass create / update sort data
  2. or, make sort data dependent key (using kvo, again in nsmanagedobject subclass)

your sort data simple as:

self.sortvalue = (self.lastname == 170 in ascii ? @"zzzzzzzzzzzzzzz" : lastname) 

Comments

Popular posts from this blog

php - mySql Join with 4 tables -

css - Text drops down with smaller window -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -