My app has 3 kinds of objects: A, B and C. Each object is represented by a dictionary like this:
NSDictionary *oneObject = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt:i], @"number",
[NSString stringWithString:@"A", @"kind", //this can be A, B or C
[NSNumber numberWithBool:YES], @"used", // YES or NO
[NSString stringWithString:oneName, @"name",
nil];
Objects like that is stored on a array like this:
NSMutableArray *listOfObjects = [NSMutable arrayWithObjects:
oneObject1, oneObject2 ..etc.. , nil];
So, I have a mutable array of dictionaries.
Now I want to sort this mutable array, obtaining a new array in the following order
1) all objects A
2) all objects B
3) all objects C
all objects are sorted in their categories... something like
object A, apple
object A, banana
object A, orange
object B, car
object B, donkey
object B, phone
object B, zebra
object C, ant
object C, box
object C, cigar
object C, hotel
object C, lamb
I mean, each category is sorted by the object name but the whole array is sorted by the category kind.
How can I do that? thanks for any help.