解析数据时根据sort排序

来源:互联网 发布:mac pro能做什么 编辑:程序博客网 时间:2024/05/22 15:59
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 要排序的数组
原创粉丝点击