Monday, 28 March 2011

Sorting Arrays

Sorting a NSMutableArray of maps by the value contained in "name_key_of_map"


NSSortDescriptor *nameSorter = [[NSSortDescriptor alloc] initWithKey:"name_key_of_map" ascending:YES selector:@selector(caseInsensitiveCompare:)];

[drinks sortUsingDescriptors:[NSArray arrayWithObject:nameSorter]];
[nameSorter release];

No comments:

Post a Comment