NSDictionary *dic1 = [NSDictionary dictionaryWithObjectsAndKeys:@"lisi",@"name",@"nan",@"sex",@"23",@"age", nil];
NSDictionary *dic2 = [NSDictionary dictionaryWithObjectsAndKeys:@"zhangsan",@"name",@"nan",@"sex",@"29",@"age", nil];
NSDictionary *dic3 = [NSDictionary dictionaryWithObjectsAndKeys:@"wangwu",@"name",@"nv",@"sex",@"18",@"age", nil];
NSDictionary *dic4 = [NSDictionary dictionaryWithObjectsAndKeys:@"zhaoliu",@"name",@"nan",@"sex",@"30",@"age", nil];
NSDictionary *dic5 = [NSDictionary dictionaryWithObjectsAndKeys:@"wali",@"name",@"nan",@"sex",@"13",@"age", nil];
NSDictionary *dic6 = [NSDictionary dictionaryWithObjectsAndKeys:@"liuhao",@"name",@"nan",@"sex",@"24",@"age", nil];
#if 0
NSMutableArray *Larray = [NSMutableArray arrayWithObjects:dic1,dic6, nil];
NSMutableArray *Warray = [NSMutableArray arrayWithObjects:dic3,dic5, nil];
NSMutableArray *Zarray = [NSMutableArray arrayWithObjects:dic2,dic4, nil];
NSMutableDictionary *bigDic = [NSMutableDictionary dictionaryWithObjectsAndKeys:Larray,@"l",Warray,@"w",Zarray,@"z", nil];
// NSLog(@"%@",bigDic);
NSMutableDictionary *newDic = [NSMutableDictionary dictionary];
for (NSMutableArray *keys in bigDic) {
NSMutableArray *array1 = [bigDic objectForKey:keys];
NSMutableArray *array = [NSMutableArray array];
for (NSMutableDictionary *dic in array1) {
Student *stu = [[Student alloc] init];
stu.name = [dic objectForKey:@"name"];
stu.age = [dic objectForKey:@"age"];
stu.sex = [dic objectForKey:@"sex"];
[array addObject:stu];
}
[newDic setObject:array forKey:keys];
}
for (NSMutableDictionary *key in newDic) {
for (Student *stu in [newDic objectForKey:key]) {
NSLog(@"%@",stu.name);
}
}
NSLog(@"%@",newDic);