標籤:
今天上午學習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);
}
}
}
}
#在藍懿學習iOS的日子#day14