more on two-way bindings and one-way bindings
more on two-way bindings and one-way bindings
- Subject: more on two-way bindings and one-way bindings
- From: Matt Neuburg <email@hidden>
- Date: Thu, 06 Jul 2006 13:03:59 -0700
- Thread-topic: more on two-way bindings and one-way bindings
Okay, this one is even weirder.
In IB, you've got an NSObjectController and MyObject. Bind
NSObjectController's contentObject to MyObject's "thing2".
In MyObject, in code, set MyObject's "thing2" to @"howdy". Sure enough, the
NSObjectController's content is also @"howdy". So the binding is working in
this direction.
No, in code, set NSObjectController's content (using setContent:) to
@"byebye". Back in MyObject, "thing2" is still @"howdy"! So even this, a
binding established in the standard way, in IB, between a controller and a
model object, is only one-way!!
But wait, there's more!!! Instead of using setContent:, use addObject: to
set the NSObjectController's content value to @"byebye". Now the binding
suddenly works in the other direction - MyObject's "thing2" is now
@"byebye"! So this is a major difference between addObject: and setContent:,
even though the docs say that for NSObjectController they are synonyms.
<http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaBindings/Con
cepts/CntrlContent.html#//apple_ref/doc/uid/TP40002147-183285-BBCDFJHD>
m.
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
<http://www.amazon.com/gp/product/0596102119>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden