iOS Reference Library Apple Developer
Search

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.




Last updated: 2009-08-14

Did this document help you? Yes It's good, but... Not helpful...