So, imagine you have a couple of arrays, Colors and Shapes, like this:
Colors: {
Yellow,
Blue,
Red
}
Shapes: {
Square,
Circle,
Diamond
}
Now, if I want to sort Colors into alphabetical order I can do something like this:
NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:nil ascending:YES selector:@selector(localizedCompare:)];
NSArray *sortedColors = [colors sortedArrayUsingDescriptors:[NSArray arrayWithObject:sortDescriptor]];
[sortDescriptor release];
But how would I sort the Shapes into the same order that I re-ordered Colors. I don't mean put Shapes into alphabetical order - I mean put Shapes into Colors' alphabetical order...?