I havenβt seen anyone really answer this question other than βuse this function, find out.β So here is some actual code that you can use.
.h( .h, )
@interface NSString (SortCompare)
-(NSInteger)stringCompare:(NSString *)str2;
@end
.m( .m .h)
@implementation NSString (SortCompare)
-(NSInteger) stringCompare:(NSString *)str2
{
return [(NSString *)self localizedCaseInsensitiveCompare:str2];
}
@end
, sortUsingSelector:
NSMutableArray:
[myArray sortUsingSelector:@selector(stringCompare:)]
NSArray:
[myArray sortedArrayUsingSelector:@selector(stringCompare:)]