< Previous PageNext Page > Hide TOC

What is Key-Value Observing?

Key-value observing provides a mechanism that allows objects to be notified of changes to specific properties of other objects.

The controller layer binding technology relies heavily on key-value observing to be notified of changes in the model and controller layers. For applications that don’t rely on the controller layer classes, key-value observing provides simplified methods for implementing inspectors and updating your user interface values.

Unlike NSNotification, there is no central object that provides change notification for all observers. Instead, notifications are sent directly to the observing objects when changes are made. NSObject provides this base implementation of key-value observing, and you should rarely need to override these methods.

You can observe any object properties including simple attributes, to-one relationships, and to-many relationships. Observers of to-many relationships are informed of the type of change made — as well as which objects are involved in the change.

Key-value observing provides an automatic observing capability for all objects. You can further refine notifications by disabling automatic observer notifications and implementing manual notifications.



< Previous PageNext Page > Hide TOC


© 2003, 2009 Apple Inc. All Rights Reserved. (Last updated: 2009-05-06)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.