Kir*_*ari 2 objective-c nsmutablearray nsindexpath ios
I have a NSMutableArray.
It contains NSIndexPaths which itself a NSUInteger array.
Array looks like this
[
(NSIndexPath xxxxxxx) 3 indexes [1, 0, 0],
(NSIndexPath xxxxxxx) 3 indexes [2, 1, 1],
(NSIndexPath xxxxxxx) 3 indexes [1, 1, 0],
(NSIndexPath xxxxxxx) 3 indexes [1, 0, 1],
Run Code Online (Sandbox Code Playgroud)
. .
]
现在我想NSMutableArray基于NSIndexPath整数数组值进行排序.结果应该是这样的.
[
(NSIndexPath xxxxxxx) 3 indexes [1, 0, 0],
(NSIndexPath xxxxxxx) 3 indexes [1, 0, 1],
(NSIndexPath xxxxxxx) 3 indexes [1, 1, 0],
(NSIndexPath xxxxxxx) 3 indexes [2, 1, 1],
Run Code Online (Sandbox Code Playgroud)
..
]
怎么做?
假设你NSMutableArray被召唤indexPaths,你可以这样做:
[indexPaths sortUsingSelector:@selector(compare:)];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1566 次 |
| 最近记录: |