Possible Duplicate:
What is the most efficient way to sort an NSSet?
I currently have an NSMutableSet with the following a list of strings. e.g.:
{@”c”,@”d”,@”e”,@”f”,@”g”,@”a”}
Can someone please tell me how I can sort these values alphabetically? Is there a way to do this using sortedArrayUsingDescriptors: ?
Sure, you can use that method:
This just creates a new sort descriptor that specifies the key “description” (NSString provides a
-descriptionmethod that returns the string). It then passes an array containing that sort descriptor as a parameter to-sortedArrayUsingDescriptors:, which you can send to any NSSet.