最佳答案
您可能可以使用NSSortDescriptor对具有指定键的字典数组进行排序.因此,例如,以下代码可以按每个字典中的键“评级”对数组进行排序:
NSSortDescriptor *ratingsSortDescriptor = [[[NSSortDescriptor alloc] initWithKey:@"ratings" ascending:YES] autorelease];
rows = [rows sortedArrayUsingDescriptors:[NSArray arrayWithObject:ratingsSortDescriptor]];