NSString *topUrl = @"http://www.maidian.tv/?c=app&a=television_category";
[NetworkCore getInfoLine:topUrl withSuccessBlock:^(id responesObj) {
NSArray *listArray = [responesObj objectForKey:@"list"];
// 1、对数组按GroupTag排序
NSArray *sortDesc = [NSArray arrayWithObject:[NSSortDescriptor sortDescriptorWithKey:@"sort" ascending:YES]];
sortedArr = [listArray sortedArrayUsingDescriptors:sortDesc];
NSLog(@"排序后的数组:%@",sortedArr);
for (NSDictionary *dic in sortedArr) {
[topDataArray addObject:dic[@"title"]];
}
[self initTopView];
}];
//sort 根据那个key排序
//YES 升序 NO 降序
//listArray 要排序的数组
解析数据时根据sort排序
最新推荐文章于 2020-05-29 02:46:22 发布