Ich habe eine NSMutableArray
, die NSIndexPath
Objekte enthält, und ich möchte sie nach ihrer row
, in aufsteigender Reihenfolge sortieren.Sortierung eines Arrays von NSIndexPfads
Was ist der kürzeste/einfachste Weg?
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)];
}];
danke! du rockst. – Eric