数组包含字典-根据key排序

时间:2025-04-03 22:05:01
NSArray *array = [NSArray array];
[array sortedArrayUsingComparator:^NSComparisonResult(id obj1, id obj2){
NSNumber index1 = [obj1 valueForKey:@"index"];
NSNumber index2 = [obj2 valueForKey:@"index"];
return [index1 compare:index2];
}];