我已经在这段代码的帮助下实现了排序。我正面临一个问题。当排序发生时,数字9出现在15000之前。我不知道该怎么做。请帮忙!
NSSortDescriptor *lastDescriptor =
[[NSSortDescriptor alloc]
initWithKey:@"priceAmount"
ascending:NO];
id obj;
NSEnumerator * enumerator = [self.messageStore objectEnumerator];
while ((obj = [enumerator nextObject]))
DebugLog(@"%@", obj);
NSMutableArray *descriptors = [NSMutableArray arrayWithObject:lastDescriptor];
self.messageStore = (NSMutableArray *)[self.messageStore sortedArrayUsingDescriptors:descriptors];
答案 0 :(得分:1)
使用选择器localizedStandardCompare
NSSortDescriptor *lastDescriptor = [[NSSortDescriptor alloc] initWithKey:@"priceAmount" ascending:NO selector:@selector(localizedStandardCompare:)];