OC-可变字典(NSMutableDictionary)操作
OC-可变字典(NSMutableDictionary)操作
// 可变字典创建
NSMutableDictionary *mdic = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"卞一", @"name", @"男", @"sex", @"啪啪啪", @"hobby", nil];
NSLog(@"%@", [mdic objectForKey:@"name"]);
// 创建空字典(开辟空间)
NSMutableDictionary *mdic_1 = [NSMutableDictionary dictionary];
// 添加/修改
[mdic setObject:@"YIem" forKey:@"name_name"];
NSLog(@"%@", [mdic objectForKey:@"name_name"]);
// 删除
[mdic removeObjectForKey:@"name"];
NSLog(@"%@", [mdic objectForKey:@"name"]);
// 查询-访问
NSLog(@"%@", [mdic objectForKey:@"sex"]);