Here is an example. Imagine you have an array of dictionaries. In the text of "Ecah dictionnary" there are 2 keys "name" and "dateOfBirth". You can sort the array using "name" as follows:
NSSortDescriptor *Sorter = [[NSSortDescriptor alloc] initWithKey:@"name" ascending:YES];
[myArray sortUsingDescriptors:[NSArray arrayWithObject:Sorter]];
[Sorter release];
Please note that myArrayis NSMutableArray.
source
share