iOS数组的快速排序

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

  //  方法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);