FROM : Matt Neuburg
DATE : Thu Jul 06 22:03:59 2006
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_removed>, <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>
DATE : Thu Jul 06 22:03:59 2006
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_removed>, <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>
| Related mails | Author | Date |
|---|---|---|
| Matt Neuburg | Jul 6, 22:03 | |
| Keary Suska | Jul 7, 20:02 | |
| Matt Neuburg | Jul 7, 21:43 |






Cocoa mail archive

