iOS处理数据(后台返回的数据根据某个字段分为多个section)
NSMutableArray *arr = dataDic[@"list"]; // NSMutableDictionary *seqDic = [NSMutableDictionary dictionary]; for (int i = 0; i < arr.count; i++) { NSMutableArray *list = [NSMutableArray array]; NSDictionary *dicTemp = arr[i]; //将空数组放进对应的时间中(过滤了重复的时间) [seqDic setValue:list forKey:dicTemp[@"createdTime"]]; } for (int i = 0; i < arr.count; i++) { //从返回的整个数据中找数据 NSDictionary *dicT = arr[i]; //取出seqDic的键(相同时间)所对应的值(数组) NSMutableArray *listArr = [seqDic valueForKey:dicT[@"createdTime"]]; [listArr addObject:dicT]; } //数组中放数组 self.dataArr = [NSMutableArray arrayWithArray:[seqDic allValues]]; //数组中放时间 self.timeArr = [NSMutableArray arrayWithArray:[seqDic allKeys]];