Re: lastKeyViewTraversingSubviewsBeginningWithView
Re: lastKeyViewTraversingSubviewsBeginningWithView
- Subject: Re: lastKeyViewTraversingSubviewsBeginningWithView
- From: Joe Ranieri <email@hidden>
- Date: Mon, 22 Feb 2010 19:06:43 -0500
On 2/22/10 6:51 PM, Arved von Brasch wrote:
Hi Cocoa List,
warning: _lastKeyViewTraversingSubviewsBeginningWithView: encountered
5000 views!!!
It usually occurs when a NSCollectionView is being refreshed, but not
every time.
I believe that NSCollectionView creates all of the item views up front,
and doesn't lazily create them or destroy them. So, there really are
5000+ subviews. You should take a look at the collection view's subviews
to see.
-- Joe Ranieri
Thanks. It does seem to be the problem. In total, there are over 10,000
(6 per represented object) views being displayed by the Collection View.
Is there a hard number written down somewhere that you're not supposed to
go over? I haven't been able to find such a warning in the documentation.
In trying to save myself Interface Builder work, I have a single
NSCollectionView that is used to display two different kinds of objects.
I have a NSCollectionView subclass that unbinds itself from one
NSArrayController, and then binds itself to the other NSArrayController at
runtime to make this work, changing its item prototype at the same time.
It worked impressively well with the handful of objects I first tested
with, but is quite slow with ~5000 objects. I think I'll have to try
separating them out as two different NSCollectionViews as a first step.
This makes sense, an NSView has a lot of overhead, relatively speaking.
I don't separating them out will help at all, since you'll still have
the problem of having 5000 views.
Is there any reason to think NSMatrix or IKImageBrowserView (with the
associated overhead of image compositing) would be more able to cope with
~5000 objects?
NSMatrix might be able to handle this better since it uses NSCells
instead of views, but it still doesn't do things lazily (as far as I
know). I'm not positive of how IKImageBrowserView does things in terms
of efficiency, but I do know it pre-loads the images from your data
source. So, if fetching the images is expensive, this could be bad.
Your best bet might just to be to write your own that does things lazily
and only has enough layers or views for what you need on screen.
-- Joe Ranieri
_______________________________________________
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