Re: Knowing if a scroll view is being scrolled
Re: Knowing if a scroll view is being scrolled
- Subject: Re: Knowing if a scroll view is being scrolled
- From: James Bucanek <email@hidden>
- Date: Thu, 15 Feb 2007 08:15:18 -0700
Half Activist wrote on Wednesday, February 14, 2007:
> Is there a way to know if a scroll view is being scrolled?
> I mean, I'm have a rather big view, that draws shadings, and there
>can be a lot of them,
> and it slows down everything.
> What I'd like to do, is when drawing, change my drawing technics
>while scrolling
> and at the end draw in full quality, somewhat like the
>isInLiveResize feature of NSView.
To the best of my knowledge, there is no "DidFinishScrolling" notification. Scroll views scroll and then redraw, but there's no way to tell if the user is finished scrolling or not.
The approach I would take would be to simply defer your finished rendering until later. Whenever a new drawRect message is received perform a fast draw and start an NSTimer to fire in, say, 1 second. When the timer fires, change states and redraw using the full rendering. If a new drawRect is received before the timer fires, reset/invalidate the timer and repeat.
The beauty of this scheme is that it doesn't matter what is redrawing or why; scrolling, resizing, opening, etc will all respond quickly, then update with the full rendering a second or so later.
--
James Bucanek
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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