Sort array of NSNumber
NSSortDescriptor *highestToLowest = [NSSortDescriptor sortDescriptorWithKey:@"self" ascending:NO];
[mutableArrayOfNumbers sortUsingDescriptors:[NSArray arrayWithObject:highestToLowest]];
Sort array of NSDictionary
NSSortDescriptor *descriptor = [[[NSSortDescriptor alloc] initWithKey:@"product_name" ascending:YES] autorelease];
NSArray *descriptors = [NSArray arrayWithObjects:descriptor, nil];
NSArray *realArray = [arrayObject sortedArrayUsingDescriptors:descriptors];
No comments:
Post a Comment