Re: NSTableView, NSArrayController, NSManagedObjectContext
Re: NSTableView, NSArrayController, NSManagedObjectContext
- Subject: Re: NSTableView, NSArrayController, NSManagedObjectContext
- From: "Ture Pålsson" <email@hidden>
- Date: Tue, 1 Jan 2008 19:34:14 +0100
On Jan 1, 2008 7:24 PM, I. Savant <email@hidden> wrote:
>
> On Jan 1, 2008, at 1:02 PM, Ture Pålsson wrote:
>
> >> Have you tried telling your *Array Controller* to -fetch: at this
> >> point?
> >
> > No. I was under the impression that the NSArrayController would watch
> > "its" moc for changes and update automagically (because the
> > "automatically prepares content" flag is set for the controller). Is
> > this not the case?
>
> Hmm ... the documentation says of that flag:
>
> "Sets whether the receiver automatically creates and inserts new
> content objects automatically when loading from a nib file."
>
> ... and ...
>
> "If ... a managed object context is set, the initial content is
> fetched from the managed object context using the current fetch
> predicate."
>
> Doesn't sound like it works the way you described to me ... ;-)
True. Then again, the docs also say "If the controller's content is
fetched automatically, set the "Automatically prepares content" switch
for the controller in the Attributes inspector in Interface Builder
(see also automaticallyPreparesContent). Doing so means that the
controller tracks inserts into and deletions from its managed object
context for its entity." That last sentence is what lead me to believe
what I believed. Maybe I should not pay too much attention to such
peripheral parts of the docs as "troubleshooting". :-)
Oh well, assuming that I do need to call refresh: on the
NSArrayController, how does one solve this architecturally? One of the
nice things about using KVO in general and Cocoa Bindings in
particular, is that models do not need to know that the NSViews and
NSControllers and stuff even exists. Now, if I need to nudge the
NSControllers to make them update themselves, that means that the
model objects need to know about the controllers. Is this not a bit
ugly, or is there some way around this that I have not realized?
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
References: | |
| >NSTableView, NSArrayController, NSManagedObjectContext (From: "Ture Pålsson" <email@hidden>) |
| >Re: NSTableView, NSArrayController, NSManagedObjectContext (From: mmalc crawford <email@hidden>) |
| >Re: NSTableView, NSArrayController, NSManagedObjectContext (From: "Ture Pålsson" <email@hidden>) |
| >Re: NSTableView, NSArrayController, NSManagedObjectContext (From: "I. Savant" <email@hidden>) |
| >Re: NSTableView, NSArrayController, NSManagedObjectContext (From: "Ture Pålsson" <email@hidden>) |
| >Re: NSTableView, NSArrayController, NSManagedObjectContext (From: "I. Savant" <email@hidden>) |