标签:
[student setValue:@"one" forKey:@"name"];
[student setValue:[NSNumber numberWithInt:17] forKey:@"age"];
在设置一个标量值时,需要先将标量值包装成一个NSNumber或NSValue对象
NSArray *keys = [NSArray arrayWithObjects:@"name", @"age", nil];
NSDictionary *dict = [student dictionaryWithValuesForKeys:keys];
NSArray *keys = [NSArray arrayWithObjects:@"name", @"age", nil];
NSArray *values = [NSArray arrayWithObjects:@"One", [NSNumber numberWithInt:16], nil];
NSDictionary *dict = [NSDictionary dictionaryWithObjects:values forKeys:keys];
[student setValuesForKeysWithDictionary:dict];
标签:
原文地址:http://www.cnblogs.com/Lidear/p/4341765.html