我是新来的objective-c,ios。 我想按照alfabetic顺序排序一个名为filteredList的NSMutableArray,它包含NSString类型的对象。排序包含NSString对象的NSMutableArray
所以如果我的可变数组包含:玛丽,比尔,约翰]我想有[比尔,玛丽,约翰]
我做了以下内容:
[filteredList sortUsingSelector:@selector(localizedCaseInsensitiveCompare:)];
但我不看到任何变化。我没有阅读和尝试其他解决方案比较:而不是localizedCaseInsensitiveCompare,但仍然没有。
https://developer.apple.com/library/ mac/documentation/Cocoa/Conceptual/Collections/Articles/Arrays.html#// apple_ref/doc/uid/20000132-SW5 or https://developer.apple.com/library/ios/documentation/cocoa/reference/foundation/Classes/NSSortDescriptor_Class/Reference/Reference.html –
您的代码将可变数组*正确地排序为[Bill,John,Mary ]。请显示一个完整的独立(非)工作示例。 –