O'Reilly logo

Cocoa Programming for OS X: The Big Nerd Ranch Guide by Aaron Hillegass, Adam Preble, Nate Chandler

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Key-Value Observing

You’ve now seen how key-value coding works, both for simple properties and to-one relationships on the one hand, and for collection properties and to-many relationships. Key-value observing (KVO), on the other hand, allows you to be informed when an object’s properties are changed, whether by KVC or by direct property access.

You saw in Chapter 8 how bindings rely on KVO: objects bound to a key are automatically added as observers of that key and are then notified whenever its value changes. To enable undo capabilities for edits, you will need to add an observer manually. In particular, you want your document object to be an observer for the keys raise and name for all the Employee objects in its employees array. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required