I am using TouchJSON to retrieve info for my app and put it in a dictionary. I would like to be able to sort it by values like difficulty and rating. How would I go about this? I have included my .m file. Thanks, enbr http://pastie.org/1091334
You can probably use NSSortDescriptor to sort the array of dictionaries with specified keys. So, for example, the following can sort the array by the key "ratings" in each dictionary:
NSSortDescriptor *ratingsSortDescriptor = [[[NSSortDescriptor alloc] initWithKey:@"ratings" ascending:YES] autorelease];
rows = [rows sortedArrayUsingDescriptors:[NSArray arrayWithObject:ratingsSortDescriptor]];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With