Objective c 如何按字母顺序对UITableView分区进行排序?
我有一个分为三类的分区UITableView。我正在使用以下代码:Objective c 如何按字母顺序对UITableView分区进行排序?,objective-c,cocoa-touch,uitableview,sorting,Objective C,Cocoa Touch,Uitableview,Sorting,我有一个分为三类的分区UITableView。我正在使用以下代码: NSArray *arrayOne = [NSArray arrayWithObjects: @"one", @"two", "three", "four", nil]; NSDictionary *dictOne = [NSDictionary dictionaryWithObject:arrayOne forKey:@"Elements"]; 对于每个类别 我如何按字母顺序对它们排序?我在这里读了一些答案,但我什么
NSArray *arrayOne = [NSArray arrayWithObjects: @"one", @"two", "three", "four", nil];
NSDictionary *dictOne = [NSDictionary dictionaryWithObject:arrayOne forKey:@"Elements"];
对于每个类别
我如何按字母顺序对它们排序?我在这里读了一些答案,但我什么也没发现
如果我用这个答案中的代码,它就不起作用了。
我有密码:
[listObjects addObject:dictOne];
如果我把
[listOfTitles sortUsingDescriptors:[NSArray arrayWithObject:titleSorter];
它不起作用
谢谢你的帮助
NSArray *arrayOne = [NSArray arrayWithObjects: @"one", @"two", "three", "four", nil];
NSArray *sortedArray = [arrayOne sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)];
NSDictionary *dictOne = [NSDictionary dictionaryWithObject:sortedArray forKey:@"Elements"];