NSCollectionView questions
NSCollectionView questions
- Subject: NSCollectionView questions
- From: Dave Hayden <email@hidden>
- Date: Wed, 6 Feb 2008 14:07:16 -0800
I've finally had a chance to play around with NSCollectionView--pretty
handy, but a few things are still giving me trouble:
As far as I can tell, IBOutlet connections from collection item
subclasses or the prototype view aren't preserved. NSControl target/
action links from the prototype view's contents to the collection item
DO work, which makes me think I need to do something in copyWithZone
or the like, but I haven't found the right magic. The only workaround
I've been able to come up with is giving the view a reference to the
collection item in setRepresentedObject:, then the view's contents can
get at the item through their superview. Ick.
I'm loading some 3,000 items into the list, and it's pretty slow.
Sampler says that the first third or so of that is setting up bindings
for the copied views. In this case the underlying data won't be
changing, so I could set up the views by hand in the collection item's
setRepresentedObject: method--but not without those IBOutlet
connections.. (The middle third is looking for button cells or
something, -[NSView _recursiveFindDefaultButtonCell]. Out of my hands,
I'd guess, if I want to have a button in the view.) The last third
appears to be setting up the animation, which I really don't need in
this case (or even notice--the contents appear instantly). Is this
avoidable?
Another odd thing I've noticed is that adding an item to the model
array causes the entire collection view to reload. (And at first, I
was using [[self mutableArrayValueForKey:@"items"]
addObjectsFromArray:] which appears to insert the objects one by one
instead of in a batch: adding 3,000 items would allocate around 4.5
million views!) I'd like to prepare data on a worker thread and feed
it in batches to the main thread to display in the collection view,
but this isn't really feasible if the view rebuilds itself from
scratch every time. Is that how it's supposed to work? Or have I
bungled something up?
Thanks!
-Dave
Panic, Inc.
_______________________________________________
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