OC基础使用(九 NsMutableDictionary 可变字典)

来源:互联网 发布:中专升大专网络教育 编辑:程序博客网 时间:2024/05/22 17:15
NsMutableDictionary 可变字典
1.创建
NSMutableDictionary *dic = [[NSMutableDictionary alloc] initWithCapacity:0];


2.添加与修改元素
[dic setObject:@"apple" forKey:@"fruit1"];


3.根据key移除元素
[dic removeObjectForKey:@"fruit2"];


4.移除所有
[dic removeAllObjects];
0 0
原创粉丝点击