数组包含字典 去重

2017-12-07  本文已影响0人  a7cdfadad9f2

NSMutableArray *categoryArray = [[NSMutableArray alloc] init];

NSMutableArray *belongArray = [[NSMutableArray alloc] init];

for (int i = 0; i<_dataArray.count; i++){

NSString *string = _dataArray[i][@"belong"];

if (![categoryArray containsObject:string]){

[categoryArray addObject:string];

[belongArray addObject:[_dataArray objectAtIndex:i]];

}

}


上一篇下一篇

猜你喜欢

热点阅读