第六十八篇、OC_按照某一字段对数值进行排序

时间:2022-03-14 08:38:38

代码中是根据“create_time_” 进行排序   ascending:决定的是升序还是降序排序

NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc]initWithKey:@"create_time_" ascending:Yes];
[dataArray sortUsingDescriptors:[NSArray arrayWithObject:sortDescriptor]];