常用 OC 排序方法:
1).不可变数组
- (NSArray*)sortedArrayUsingSelector:(SEL)comparator;
- (NSArray*)sortedArrayUsingComparator:(NSComparator)cmptr;
2)可变数组
- (void)sortUsingSelector:(SEL)comparator;
- (void)sortUsingComparator:(NSComparator)cmptr;
3).字典排序
- (NSArray*)keysSortedByValueUsingComparator:(NSComparator)cmptr ;
- (NSArray*)keysSortedByValueUsingSelector:(SEL)comparator;
网友评论