iOS: sorting an NSArray of core data objects

This question already has an answer here:

  • How do I sort an NSMutableArray with custom objects in it? 25 answers

  • NSMutableArray *sortedArray;
    sortedArray = [array sortedArrayUsingComparator:^NSComparisonResult(id a, id b) {
        NSNumber *s1 = @([(Struct *)a value]);
        NSNumber *s2 = @([(Struct *)b value]);
        return [s1 compare:s2];
    }];
    
    链接地址: http://www.djcxy.com/p/70834.html

    上一篇: 多类的Java泛型通配符

    下一篇: iOS:对核心数据对象的NSArray进行排序