Re: -setNeedsDisplay: different between Tiger and Leopard
Re: -setNeedsDisplay: different between Tiger and Leopard
- Subject: Re: -setNeedsDisplay: different between Tiger and Leopard
- From: John Stiles <email@hidden>
- Date: Fri, 14 Dec 2007 21:09:09 -0800
I just did a test and, in both Tiger and Leopard, you can do this and
it works perfectly:
[[control superview] setNeedsDisplayInRect:[control frame]];
[control setFrame: newFrame];
[[control superview] setNeedsDisplayInRect:[control frame]];
On Dec 14, 2007, at 10:29 AM, glenn andreas wrote:
On Dec 14, 2007, at 12:13 PM, John Stiles wrote:
I am writing code that moves a control from one place to another.
In Leopard, this works great:
[control setNeedsDisplay:YES]; // clean up at old location
[control setFrame:newFrame]; // move control
[control setNeedsDisplay:YES]; // redraw at new location
However, in Tiger, this doesn't work properly; the control is not
erased from its old location. It behaves as if the first -
setNeedsDisplay: was not called at all. (And in fact, on Leopard,
if you remove the first -setNeedsDisplay:, you get the same
artifacts.)
What's the simplest way to fix this on all OSes?
Just a guess, but how about:
[[control superview] setNeedsDisplay: YES];
[control setFrame: newFrame];
[control setNeedsDisplay: YES];
(ideally, setNeedsDisplayInRect should probably be called instead
to limit what the superview redraws)
Glenn Andreas email@hidden
<http://www.gandreas.com/> wicked fun!
quadrium | prime : build, mutate, evolve, animate : the next
generation of fractal art
_______________________________________________
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