今天上午学习uitabelViewcell和下午学习用uitabelViewcel来显示手机播放器的客户端显示歌词的界面,和字典
// 创建不可变字典
NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys:@"zhangsan",@"name",@"18",@"age", nil];
dic = @{@"name":@"zhangsan",@"age":@"18"};
// 创建可变字典
NSMutableDictionary *md = [NSMutableDictionary dictionary];
[md setObject:@"lisi" forKey:@"name"];
[md setObject:@(11) forKey:@"age"];
NSLog(@"%@",md);
NSMutableDictionary *china = [NSMutableDictionary dictionary];
NSMutableDictionary *hebeiDic = [NSMutableDictionary dictionary];
[hebeiDic setObject:@[@"滦县",@"路南",@"乐亭"] forKey:@"唐山"];
[hebeiDic setObject:@[@"新城",@"桥东区",@"桥西区"] forKey:@"石家庄"];
[china setObject:hebeiDic forKey:@"河北"];
NSMutableDictionary *liaoNingDic = [NSMutableDictionary dictionary];
[liaoNingDic setObject:@[@"大娃",@"二娃",@"三娃"] forKey:@"葫芦岛"];
[liaoNingDic setObject:@[@"皇姑区",@"皇姑父区",@"黄神曲"] forKey:@"沈阳"];
[china setObject:liaoNingDic forKey:@"辽宁"];
NSDictionary *lnDic = [china objectForKey:@"辽宁"];
// NSArray *shenyangArr = lnDic[@"沈阳"];
// for (NSString *s in shenyangArr) {
// NSLog(@"%@",s);
// }
// 如何遍历字典
for (NSString *key in china.allKeys) {
NSLog(@"省-%@",key);
NSDictionary *shengDic = china[key];
for (NSString *shiKey in shengDic.allKeys) {
NSLog(@"市-%@",shiKey);
NSArray *xianArr = shengDic[shiKey];
for (NSArray *xian in xianArr) {
NSLog(@"县-%@",xian);
}
}
}
}