我正在使用以下代码对 NSDictionaries 的 NSArray 进行排序
NSArray *getIndexArray = [nicknamesCombinedArray copy];
NSSortDescriptor *descriptor = [[NSSortDescriptor alloc] initWithKey:@"MANUFACTURER" ascending:YES];
NSDictionary *sortedGetIndexArray = [getIndexArray sortedArrayUsingDescriptors:[NSArray arrayWithObjects:descriptor,nil]];
唯一的问题是,当它排序时,如果单词全部大写,那么它会像这样排序
JESS
Jack
Jelly
Job
我想要的地方
Jack
Jelly
JESS
Job
最佳答案
试试这段代码..
NSSortDescriptor *descriptor = [[NSSortDescriptor alloc] initWithKey:@"MANUFACTURER" ascending:YES selector:@selector(localizedCaseInsensitiveCompare:)];
关于ios - 排序 NSArray 的 NSDictionaries 忽略大小写,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22029921/