NSArray *arrData = @[@"1",@"2",@"3",@"4"];
NSArray *arrKey = @[@"A",@"B",@"C",@"D"];
NSMutableDictionary *dic = [NSMutableDictionary dictionaryWithObjects:arrData forKeys:arrKey];
NSArray *arrData1 = @[@"5",@"6",@"7",@"8"];
NSArray *arrKey1 = @[@"E",@"F",@"G",@"H"];
NSMutableDictionary *dic1 = [NSMutableDictionary dictionaryWithObjects:arrData1 forKeys:arrKey1];
NSMutableArray *arr = [NSMutableArray arrayWithObjects:dic,dic1, nil];
for (int i=0; i<[arr count]; i++) {
for (id f in [arr objectAtIndex:i]) {
NSLog(@"value = %@",[[arr objectAtIndex:i] valueForKey:f]);
NSLog(@"key = %@",f);
}
}
NSLog(@"arr = %@",[arr description]);
结果:
转载于:https://blog.51cto.com/duxinfeng/1214724