Re: Getting a callback before repain
Re: Getting a callback before repain
- Subject: Re: Getting a callback before repain
- From: Nicholas Francis <email@hidden>
- Date: Fri, 9 Jan 2004 11:08:15 +0100
Unfortunately performSelector:withObject:afterDelay doesn't execute
until after a window repaint (which results in some flickering)...
any others?
TIA,
Nicholas
On Jan 9, 2004, at 12:59 AM, Public Look wrote:
>
>
On Jan 8, 2004, at 4:45 PM, Nicholas Francis wrote:
>
>
> Hi guys...
>
>
>
>
[deleted]
>
>
>
>
> Basically, this means that if I add 20 new views, I get the dubious
>
> honor of reflowin n^2 times - hence I would like to just mark my view
>
> as needing a reflow and the do that before a repaint, but AFTER
>
> adding all 20 views.
>
>
>
> Any hints?
>
>
>
>
>
>
Just call your reflow method like this each time a subview is added:
>
>
[[self class] cancelPreviousPerformRequestsWithTarget:self];
>
[self performSelector:@selector(reflow:) withObject:self
>
afterDelay:0.0];
>
>
>
The reflow method will be called automatically my the run loop as soon
>
as control returns to the run loop. Therefore, if you add 20 views
>
within a tight loop and don't return control to the run loop, the
>
reflow message will be sent exactly once.
>
>
See the NSObject documentation along with NSRunLoop.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.