Ich bin ein NSMutableArray
Sortierung wie folgt:NSMutableArray Sortierung - Groß- und Kleinschreibung
NSSortDescriptor *sortDescriptor;
sortDescriptor = [[[NSSortDescriptor alloc] initWithKey:str_key ascending:bool_asc_desc] autorelease];
NSArray *sortDescriptors = [NSArray arrayWithObject:sortDescriptor];
NSArray *sortedArray;
sortedArray = [ads_printers_array sortedArrayUsingDescriptors:sortDescriptors];
Das Problem ist, dass dieser Fall empfindlich ist, und ich möchte es Groß- und Kleinschreibung machen. Wie kann ich das machen? Ich habe versucht, die Dokumentation zu lesen und fand etwas wie folgt aus:
sortDescriptor = [[[NSSortDescriptor alloc] initWithKey:str_key ascending:bool_asc_desc selector: @selector(caseInsensitiveCompare)] autorelease];
aber ich habe keine Ahnung, was ich in den Selektor Argument werden setzen sollte. Vielen Dank!
möglich Duplikat [Ich möchte ein Array mit NSSortDescriptor sortieren] (http://stackoverflow.com/questions/5542762/i- want-to-sort-ein-array-using-nssortdescriptor) –
Auschecken folgenden Beitrag: http://StackOverflow.com/a/5542888/200272 –
Vielen Dank, für alle Interessierten die Selektor-Methode, die ich verwendet habe (localizedCaseInsensitiveCompare :) . Prost! – Kevin