Sorting NSMutableArray with NSStrings in alphabetical order
I have a NSMutableArray with NSStrings and I want t开发者_StackOverflow社区o sort them in alphabetical order, seems it's no hard, but I didn't find nice solution. Help me please.
Using sortUsingSelector:
method with compare:
as comparing selector:
NSMutableArray* strings = [NSMutableArray arrayWithObjects:@"dog", @"ant", @"cat",nil];
[strings sortUsingSelector:@selector(compare:)];
NSLog(@"%@", strings);
精彩评论