我正在对数组进行排序并将其添加到tableview并添加索引值。我面临的问题是无法添加以特殊字符开头的字符串,但如果字符串包含first和lastplace之间的特殊字符,则它正常工作。以下是我正在使用的代码,
self.SectionArray = [NSMutableArray arrayWithCapacity:unsortedSections.count];
for (NSMutableArray *unsortedArray in unsortedSections) {
NSArray *sortedArray = [unsortedArray sortedArrayUsingComparator:^NSComparisonResult(id obj1, id obj2) {
NSDictionary *country1 = obj1[@"c1"];
NSDictionary *country2 = obj2[@"c1"];
return [country1[@"n1"] compare:country2[@"n1"]];
}];
[self.SectionArray addObject:sortedArray];
}