Re: Custom View drawn twice?
Re: Custom View drawn twice?
- Subject: Re: Custom View drawn twice?
- From: Ben Lachman <email@hidden>
- Date: Fri, 14 Mar 2008 04:11:05 -0400
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;
}
...
Thanks to all those who responded to my original post. Hopefully
this will help someone else down the road.
->Ben
--
Ben Lachman
Acacia Tree Software
http://acaciatreesoftware.com
email@hidden
740.590.0009
On Mar 5, 2008, at 4:22 PM, Ben Lachman wrote:
displayIfNeededIgnoringOpacity goes back up the view hierarchy
looking for an opaque superview to start drawing with. Doing so was
causing an infinite drawing loop. I'm pretty sure this is because
you're not really supposed to be calling setNeedsDisplay...: and
displayIfNeeded...: within your drawRect: method. In any case it
was a nasty hack to get correct looking functionality and I'm
actually more interested in figuring out what is causing the double
drawing than hack a fix on top of it.
On Mar 3, 2008, at 5:38 AM, Uli Kusterer wrote:
Am 29.02.2008 um 20:55 schrieb Ben Lachman:
[self displayIfNeededIgnoringOpacity];
Is there a particular reason why you're calling this method?
Won't plain old -displayIfNeeded do the job?
_______________________________________________
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