Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 32. Bindings and Controllers > Collaboration of Patterns Within Binding...

Collaboration of Patterns Within Bindings and Controllers

Once the behavior of binding has been explained, programmers commonly want to know how bindings work. Although bindings are an advanced topic, there’s really no magic. Interface Builder sends -(void)bind:(NSString *)binding toObject:(id)observableController withKeyPath:(NSString *)keyPath options:(NSDictionary *)options messages when it establishes bindings, and you can send the same messages to establish bindings programmatically.

Key Value Coding and Key Value Observing technologies underlie bindings. Key Value Coding is briefly described in Chapter 19 and again in Chapter 30, “Core Data Models.” It is a variation of the Associative Storage pattern, which lets you access the properties of objects as if every object were a simple dictionary of key/value pairs. See Apple’s conceptual documentation for Key Value Coding at http://developer.apple.com/documentation/Cocoa/Conceptual/KeyValueCoding/KeyValueCoding.html. Key Value Observing is a variation of the Notification pattern from Chapter 14, “Notifications.” Key Value Observing monitors the values of object properties on behalf of other objects that are interested observers. The underlying implementation of Key Value Observing is somewhat different from the Notification pattern, but in essence, Key Value Observing serves the same function: Register to receive messages when something of interest happens. Apple’s conceptual documentation for Key Value Observing is at http://developer.apple.com/documentation/Cocoa/Conceptual/KeyValueObserving/KeyValueObserving.html.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint