#在蓝懿学习iOS的日子#day14

今天上午学习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);

            }

}

}
}

posted @ 2015-11-08 21:17  一笑抿江湖  阅读(119)  评论(0编辑  收藏  举报