Re: when automatically prepares content doesn't
Re: when automatically prepares content doesn't
- Subject: Re: when automatically prepares content doesn't
- From: Keary Suska <email@hidden>
- Date: Sat, 17 Jun 2006 17:43:19 -0600
on 6/17/06 1:16 PM, email@hidden purportedly said:
>> My understanding is that "automatically prepares content" is used *instead*
>> of a content binding or outlet.
>
> I guess I'd like to know where you get that understanding. I'm not saying
> you're wrong; I'm asking where to look in the docs.
I get this, and the below, from:
http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaBindings/Conc
epts/CntrlContent.html#//apple_ref/doc/uid/TP40002147-183071
The examples are what spell it out for me. How I come to the "instead"
conclusion is because of object instantiation--i.e., the controller
instantiates an object of the specified object class, instead of using an
object that already exists or belongs to a different object. However, see
below for how "instead" may not be the case.
>> AFAIK, in auto mode, the controller instantiates it's own NSMutableArray to
>> contain objects as specified in "object class name". In your example, I
>> would assume that this means that the controller's "thing" is different from
>> MyObject's "thing".
>
> Well, maybe I'm just not understanding any of this. My base case was to bind
> the NSArrayController to MyObject's "thing", with no other code. When (in
> the app's interface) I add a row and edit it, MyObject's "thing" goes from
> being null to being an array of dictionaries, with the correct values.
This is the expected behavior, although I wasn't aware that the controller
would allocate for a nil object, but apparently it does. It's possible that
if a bound content object is nil, the controller instantiates it anyway and
sets the bound content object to the new object. I am just guessing here,
since I have never seen this documented anywhere. In this case, my "instead"
conclusion may not be the case.
> On the other hand, it does this whether or not "automatically prepares
> content" is checked. So I'm no closer to understanding "automatically
> prepares content".
The only reason for the option, it seems to me, is to allow you to override
-prepareContent in a controller subclass to "initialize" (quoted so as not
to refer to the class method) the content object with controller-defined
values. Otherwise, as your experiments seems to indicate, it doesn't seem to
matter whether you use the option or not. It may be a matter of style or
design--i.e., who is responsible for "initializing" the content object?
> And I still don't understand why implementing accessors would cause this
> behavior to break. m.
Neither do I, but then I am not sure what you mean by "keyed accessors to
'thing'." The issue may have to do with how your are binding the content
object.
Best,
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
_______________________________________________
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