iOS 数组里面取字典的值
2024-09-12 20:04:17
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
最新文章
- Geolocation API 原理及方法
- phpcmsV9.5.8整合百度编辑器Ueditor1.4.3教程
- ViewPager部分源码分析三:scroll
- JSON做下拉表格
- 最新版Duilib在VS2012下编译错误的解决方法
- oc 正则图片<;img />; 标签
- [转]SQL:JOIN用法
- 【并发编程】AQS学习
- ios assetlibrary
- Android第三方授权(新浪微博篇)
- 闭包中的 this 对象
- KVM虚拟机介绍
- Codeforces Round #346 (Div. 2) A Round-House
- Unity3d 物体沿着正七边形轨迹移动
- 语音传输之RTP/RTCP/UDP及软件实现关键点
- c# 颜色RGB到HSB互相转换
- java的枚举2
- MySql 学习之路-基础
- 文件上传submit、ajax方式
- 树莓派进阶之路 (013) - 树莓派2/3 C语言使用PWM