Re: Precaching NSViews
Re: Precaching NSViews
- Subject: Re: Precaching NSViews
- From: John Hörnkvist <email@hidden>
- Date: Wed, 3 Oct 2001 01:05:00 +0200
On Wednesday, October 3, 2001, at 12:47 AM, Joe Howard wrote:
In my app I'm working on I have a custom view in a scroll view with
between 20 - 100 subviews in the custom view. Each of these subviews
will have a NSImageView containing, you guessed it, an NSImage. My
problem is that even with only about 8 of these subviews when I try and
scroll the scrolling stutters.
With about 100 items, the scrolling is very choppy. This is on 10.1
on a Dual 800 and GeForce3 so my machine shouldn't be a problem.
What I'm trying to get at, is there a way that I can precache these
subviews so that they don't need to redisplay all the time or some
other technique to speed up the scrolling. If you look at the Desktop
preference pane in System Preferences is does something similar with
all of the images but does not have the redraw problems that I'm
having. However, I doubt the Deskop prefpane is adding a subview for
every image.
It's difficult to know what your problem is without knowing more about
the application, and it is difficult to solve it without knowing the
intent of your design.
First, try [[scrollView clipView] setCopiesOnScroll:YES].
Second, try using cells instead of subviews if possible. NSImageCell,
for example.
Third, cache the whole thing in an NSImage.
Fourth, use the GraphicKit, and it will be my job to make sure it works
fast enough. :)
Regards,
John Hornkvist
--
ToastedMarshmallow, the perfect Cocoa companion
http://www.toastedmarshmallow.com