This morning to learn Uitabelviewcell and afternoon learning with Uitabelviewcel to display the interface of the lyrics to the client of the mobile player, and the dictionary
Creating immutable Dictionaries
nsdictionary *dic = [nsdictionary dictionarywithobjectsandkeys:@ "Zhangsan"@ "Name", @ "@",@ "age", Nil];
DIC = @{@ "name":@ "Zhangsan" @ "Age":@ "@"};
Create a mutable dictionary
nsmutabledictionary *md = [nsmutabledictionary dictionary];
[MD SetObject:@ "Lisi" forkey:@ "name"];
[MD SetObject:@ (one) forkey:@ "age"];
NSLog(@ "%@", MD);
nsmutabledictionary *china = [nsmutabledictionary dictionary];
nsmutabledictionary *hebeidic = [nsmutabledictionary dictionary];
[hebeidic setobject: @[@ " Luan County " , @ " nan " ,@ " laoting "] forkey: @ " Tangshan "
[Hebeidic setobject:@[@ "New town " @ "Qiaodong District" @ " Qiaoxi District "] forkey:@ " Shijiazhuang "];
[China setobject: Hebeidic forkey:@ " Hebei "];
nsmutabledictionary *liaoningdic = [nsmutabledictionary dictionary];
[liaoningdic setobject: @[@ " Dava " , @ " she " ,@ " Three Dolls "] forkey: @ " Huludao " ];
[Liaoningdic setobject:@[@ " Huanggu District ",@ " Huanggu Parent Zone "@ " Huang Divine Comedy " ] forkey:@ " Shenyang "];
[China setobject: Liaoningdic forkey:@ " Liaoning "];
nsdictionary *lndic = [China objectforkey:@ " Liaoning "];
Nsarray *shenyangarr = lndic[@ " Shenyang "];
For (NSString *s in Shenyangarr) {
NSLog (@ "%@", s);
// }
How to traverse a dictionary
for (nsstring *key in China . AllKeys) {
NSLog(@ " province -%@", key);
nsdictionary *shengdic = China[key];
for (nsstring *shikey in shengdic. AllKeys) {
NSLog(@ " City -%@", Shikey);
nsarray *xianarr = Shengdic[shikey];
for (nsarray *xian in xianarr) {
NSLog(@ " County -%@", Xian);
}
}
}
}
#在蓝懿学习iOS的日子 #day14