iOS 数组里面取字典的值

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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]);

 原文http://duxinfeng.blog.51cto.com/3911492/1214724

iOS 数组里面取字典的值

上一篇:浅谈公交卡业务流程


下一篇:struts.xml配置文件