1. Use Setvalue:forkey: To set the name of the student object
[student setvalue:@ "one" forkey:@ "name"];
Use Setvalue:forkey: Set age for Student objects
[student Setvalue:[nsnumber Numberwithint:17] forkey:@ "Age"];
When you set a scalar value, you need to wrap the scalar value into a nsnumber or Nsvalue object first
2. KVC can make bulk changes to objects For example, get student's age and name
Nsarray *keys = [Nsarray arraywithobjects:@] Name ", @" age ", nil];
Nsdictionary *dict = [student Dictionarywithvaluesforkeys:keys];
3. Set student's age and name
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];
Set method in KVO/KVC