December 2013
Intermediate to advanced
132 pages
1h 58m
English
CHAPTER 21
![]()
Key-Value Coding
Key-Value Coding Defined
Normally when you want to get or set property values in an object you use dot notation to get a reference to the property to change the value. However, with key-value coding you can store and retrieve property values indirectly using string keys. Applications that require archiving need this type of functionality so that apps can retrieve object data from archive files.
Setting Property Values
You can use key-value coding to set property values. To set property values, you must use the setValue:forKey: message and provide the new property value and the NSString name of the property.
[p setValue:@"New ...Read now
Unlock full access