setValue:forKey:determine the data type required by a property’s accessor or instance variable, given a particular key. If the data type is not an object, the setter first sends an appropriate
Valuemessage to the incoming value object to extract the underlying data, and stores that instead.
For example, if the type of the property being set is
@property int index;
KVC will attempt to invoke the
intValue method on the provided value to convert it to the appropriate type before setting the property value:
[self setValue:@"10" forKey:@"index"]; // calls intValue on "10"
Thanks very much to Stack Overflow user CRD for providing the answer!