码迷,mamicode.com
首页 > 移动开发 > 详细

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

时间:2015-11-08 22:25:31      阅读:213      评论:0      收藏:0      [点我收藏+]

标签:

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

标签:

原文地址:http://www.cnblogs.com/odileye/p/4948357.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!