NSDictionary * dict = @{@"1":@"one",@"2":@"two",@"3":@"three"};
NSLog(@"dict = %@",dict);
NSDictionary *dict1 =[[NSDictionary alloc] initWithObjectsAndKeys:@"one",@"1",@"two",@"2", nil];
NSLog(@"dict1 = %@", dict1);
NSDictionary *dict2 = [NSDictionary dictionaryWithObject:@"four" forKey:@"4"];
NSLog(@"dict2 = %@", dict2);
NSEnumerator * keyenum = [dict keyEnumerator];
id obj = nil;
while (obj = [keyenum nextObject]) {
NSLog(@"key = %@, value =%@", obj, [dict objectForKey:obj]);
}
NSMutableDictionary *dict3 = [NSMutableDictionary dictionaryWithDictionary:dict];
NSLog(@"dict3 = %@",dict3);
NSArray * array = [dict3 allKeys];
NSLog(@"array = %@",array);
[dict3 addEntriesFromDictionary:dict2];
NSLog(@"dict3 = %@",dict3);
OC -基础(六) 学习中。。。
最新推荐文章于 2023-10-01 23:26:19 发布