iphone - Sort Core Data alphabetically with special characters -



iphone - Sort Core Data alphabetically with special characters -

i have entity in core info containing lot names. of names has special characters in them, i.e Åfjord. names starting letter Å, needs @ bottom of tableview, because it's lastly letter in norwegian alphabet.

-(nsarray *)getfetchedobjects:(nsmanagedobjectcontext *)context entityname:(nsstring *)entityname sortkey:(nsstring *)key{ nserror *error = nil; nsfetchrequest *fetchrequest = [[nsfetchrequest alloc]init]; nsentitydescription *entity = [nsentitydescription entityforname:entityname inmanagedobjectcontext:context]; [fetchrequest setentity:entity]; if (key != nil) { nssortdescriptor *sortdescriptor = [[nssortdescriptor alloc]initwithkey:key ascending:yes]; nsarray *sortdescs = [[nsarray alloc]initwithobjects:sortdescriptor, nil]; [fetchrequest setsortdescriptors:sortdescs]; } homecoming [context executefetchrequest:fetchrequest error:&error];

}

and phone call method so:

places = [jsonmethods fetchobjectsforentityname:@"places" withpredicate:nil context:self.context sortkey:@"name"];

the output is:

aaaa aaaa ÅÅÅÅ bbbb bbbb ... , on

i tried selector nssortdescriptor like:

nssortdescriptor *sortdescriptor = [[nssortdescriptor alloc]initwithkey:key ascending:yes selector:@selector(localizedcaseinsensitivecompare:)];

but set names starting Å @ top

like said, need have names starting Å @ bottom.

how can accomplish this?

thanks!

i think nspredicate should more appropriate in scenario.

iphone xcode cocoa-touch cocoa sorting

Comments

Popular posts from this blog

delphi - blogger via idHTTP : error 400 bad request -

c++ - compiler errors when initializing EXPECT_CALL with function which has program_options::variables_map as parameter -

How do I check if an insert was successful with MySQLdb in Python? -