oc将字典中内容添加到数组中
#import <Foundation/Foundation.h>
int main(int argc, const char * argv[]) {
@autoreleasepool {
//数组和字典结合使用
NSDictionary*dic=@{@"name":@"zhan san",@"class":@"ios5",@"age":@"20"};
NSDictionary*dic2=@{@"name":@"zhan san",@"class":@"ios5",@"age":@"20"};
NSMutableArray *muarr=[NSMutableArray array];
[muarr addObject:dic];
[muarr addObject:dic2];
//遍历数组当中的内容
for (id str in muarr)
{
NSDictionary*dic0=str;
NSLog(@"xingming:%@,banji:%@,nianling:%@",dic0[@"name"],dic0[@"class"],dic0[@"age"]);
//NSLog(@"%@",muarr);
}
}
return 0;
}