我有一個NSMutableArray
包含NSIndexPath
對象,我想按它們的row
按升序對它們進行排序。對NSIndexPaths數組排序
什麼是最短/最簡單的方法呢?
這是我已經試過:
[self.selectedIndexPaths sortUsingComparator:^NSComparisonResult(id obj1, id obj2) {
NSIndexPath *indexPath1 = obj1;
NSIndexPath *indexPath2 = obj2;
return [@(indexPath1.section) compare:@(indexPath2.section)];
}];
謝謝!你搖滾。 – Eric 2013-02-18 03:47:32