Re: Saving NSObjectController info
Re: Saving NSObjectController info
- Subject: Re: Saving NSObjectController info
- From: James McConnell <email@hidden>
- Date: Tue, 15 Feb 2005 16:38:52 -0600
On 2/15/05 12:18 PM, "mmalcolm crawford" <email@hidden> wrote:
>
> On Feb 15, 2005, at 1:28 AM, <email@hidden> wrote:
>> Nevermind, actually figured this out on my own. For those that might
>> be wondering (I'm sure you're out there somewhere), what I did was
>> make an outlet in MyDocument of type NSObjectController, connected
>> the NSObjectController in IB to the outlet, then just used content:
>> and setContent: methods in place of the earlier methods I was using
>> with a custom controller object.
>>
>
> For what you describe, you should not need to make an outlet to the
> object controller. It is the responsibility of the document instance
> to manage the model (including archiving and unarchiving). The
> 'content' of the object controller should be bound to the relevant
> attribute of the document. As changes are made in the user interface,
> they are automatically propagated to the model (using KVC)... backing
> up to the bindings Big Picture -- recall that the goal is to keep user
> interface and model values in sync.
>
> mmalc
Then how do you advise I go about this simple problem? Because it is the
object controller that is taking care of setting model instance variables
after my textfields have been edited, yet the actual instance of the model
object that the object controller is handling is never specifically
referenced in my code. And the examples I've done (CurrencyConverter with
Bindings to be honest), never actually references the instance of the model
object the object controller handles in the code.
So in MyDocument, how do I archive and unarchive the model object if it is
never explicitly referenced in my code? By having access to the content of
the object controller in the code (MyDocument), I can get to the instance of
the model object. The way I have it set now does seem to work just fine,
but it's something I figured out on my own, and my goal is to learn the
correct way to do these things.
I don't have access to my code (The project is on my PowerBook, which I
don't have immediate access to at this moment), but later tonight I will
post the relevant code I have. Maybe I'm not explaining myself clearly.
Thanks for your response, Malcolm. I know you do a lot for this list, so
your help and advice is appreciated.
James
_______________________________________________
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