Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个带有 NSStrings 的 NSMutableArray,我想按字母顺序对它们进行排序,似乎并不难,但我没有找到好的解决方案。请帮帮我。
使用sortUsingSelector:方法 with compare:as 比较选择器:
sortUsingSelector:
compare:
NSMutableArray* strings = [NSMutableArray arrayWithObjects:@"dog", @"ant", @"cat",nil]; [strings sortUsingSelector:@selector(compare:)]; NSLog(@"%@", strings);