Sortieren eines Arrays von NSIndexPaths

Ich habe eine NSMutableArray enthält NSIndexPath Objekte, und ich möchte, um Sie zu Sortieren durch Ihre row in aufsteigender Reihenfolge.

Was ist der kürzeste/einfachste Weg, es zu tun?

Dies ist, was ich versucht habe:

[self.selectedIndexPaths sortUsingComparator:^NSComparisonResult(id obj1, id obj2) {
    NSIndexPath *indexPath1 = obj1;
    NSIndexPath *indexPath2 = obj2;
    return [@(indexPath1.section) compare:@(indexPath2.section)];
}];
InformationsquelleAutor Eric | 2013-02-18
Schreibe einen Kommentar