I have a custom object like:
#import
@interface Store : NSObject{
NSString *name;
NSString *address;
}
@property (nonat
NSSortDescriptor *sortDescriptor =
[NSSortDescriptor sortDescriptorWithKey:@"name"
ascending:YES
selector:@selector(caseInsensitiveCompare:)];
[nameOfArray sortedArrayUsingDescriptors:@[sortDescriptor]];
Related documentation:
Regexident's answer is based on NSArrays, the corresponding in-place sorting for NSMutableArray would be -sortUsingDescriptors:
[storeArray sortUsingDescriptors:
[NSArray arrayWithObject:[NSSortDescriptor sortDescriptorWithKey:@"name"
ascending:YES
selector:@selector(caseInsensitiveCompare:)]]];
Now storeArray
it-self will be sorted.