Re: NSArrayController vs. fetch
Re: NSArrayController vs. fetch
- Subject: Re: NSArrayController vs. fetch
- From: Matteo Rossi <email@hidden>
- Date: Sun, 8 Oct 2006 00:37:21 +0200
What the array controller contains (and the value of
arrangedObjects) is determined by the setting of
'automaticallyPreparesContent' and the filterPredicate. It is not
determined by the table view.
Assuming you're only using a single managed object context and only
one application is updating the store, then setting
automaticallyPreparesContent to YES means that the array controller
keeps itself up-to-date with insertions and deletions -- this is
described in <http://developer.apple.com/documentation/Cocoa/
Reference/ApplicationKit/Classes/NSArrayController_Class/Reference/
Reference.html#//apple_ref/occ/instm/NSArrayController/
setAutomaticallyPreparesContent:>.
Thank you for your help. I think I've found the solution. I manage CD
lines and use a NSArrayController to modify their properties in an
information panel. When I draw a new line, I add it programmatically
by using [initWithEntity: insertIntoManagedObject] and send a
notification to update my drawing view. My problem was that if I
tried to retrieve all lines in drawRect: by usign [myArrayController
arrangedObjects] I didn't succeed to retrieve the last one I had
drawn. I think it's due to the fact that the object graph is updated
once per cycle and NOT NECESSARILY before drawRect was called. My
first workaround was to execute a fetch. But I've found that the
correct way is to invoke [moc processPendingChanges]. Thank you
again, mmalc.
_______________________________________________
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