// 方法1:NSComparator NSArray *listGroupname = [self.listTeams sortedArrayUsingComparator:^(NSString *n1,NSString *n2) { NSString *val1 = [[NSString alloc]init]; NSString *val2 = [[NSString alloc]init]; if (val1 > val2) { return NSOrderedAscending; } else { return NSOrderedDescending; } }]; NSLog(@"%@",listGroupname);