1.

What are KVC and KVO? Provide an example.

Answer»

KVC stands for Key-VALUE-Coding. It refers to accessing a PROPERTY or value using a string.
id someValue = [myObject valueForKeyPath:@”foo.bar.baz”];
Which could be the same as:
id someValue = [[[myObject foo] bar] baz];


KOC stands for Key-Value-Observing. It allows PROGRAMMERS to OBSERVE changes in property or value.
In order to observe a property using KVO, you should identify the property with a string. The observable object must be KVC compliant.
[myObject addObserver:self forKeyPath:@”foo.bar.baz” options:0 context:NULL];



Discussion

No Comment Found