Re: Custom View drawn twice?
Re: Custom View drawn twice?
- Subject: Re: Custom View drawn twice?
- From: Uli Kusterer <email@hidden>
- Date: Fri, 14 Mar 2008 13:34:42 +0100
On 14.03.2008, at 09:11, Ben Lachman wrote:
I think I finally solved this while chatting with Wil Shipley
earlier this evening. Wil mentioned sometimes needing to display
from the opaque ancestor which is basically what I was trying to do
with the code Uli questioned. The way I was doing it was only
partially successful at best. Given Wil's hints, I added the
following to my drawing code and my drawing glitches are no more:
- (void)drawRect:(NSRect)rect {
static BOOL toggle = YES;
if( toggle ) {
toggle = NO;
[[self opaqueAncestor] display];
return;
} else {
toggle = YES;
}
...
I think you're supposed to call display outside of drawRect, not
inside. What you're doing here is requesting the OS to draw everything
twice, once with toggle YES, once with toggle NO. Only your view
doesn't draw as long as toggle is YES.
Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de
_______________________________________________
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