Re: NSArrayController vs. fetch
Re: NSArrayController vs. fetch
- Subject: Re: NSArrayController vs. fetch
- From: Matteo Rossi <email@hidden>
- Date: Sat, 7 Oct 2006 09:36:21 +0200
If you want to perform an operation on the content of a table view
provided by an array controller, then use -arrangedObjects --
that's what it's there for...
Well, indeed, I don't want to perform an operation on a tableview, I
use arrangedObjects to retrieve all entities of a certain kind and
draw them on screen (they are lines); my primary goal is an
***UPDATED*** array of lines; the second one is a fast response. In
other words I must be sure that all entities are correctly
synchronized to the ones I creates/removed/modified. Is it correct
that they are ONLY IF the tableview is displayed ? If I hide my
tableview (or have no tableview at all) and add an entity
programmatically, I think I'll have to run a fetch to retrieve all
entities including the last one inserted. Am I wrong ? Is there a
workaround for this ?
If you perform a fetch, then you may get back a different result
set (notably if the content of the array controller is filtered)
and the ordering may be different (in some situations this might be
important to you). Moreover, the fetch incurs a round trip to the
persistent store, whereas the value of arrangedObjects may be cached.
mmalc
I've run a test to check for performances. A fetch is 2-3 times
slower than arrangedObjects.
_______________________________________________
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