So I tried this and wasn't able to get it to display the behavior, which makes me assume the issue must be the interaction with the rest of the views in the hierarchy. If I turn off all calls to setNeedsDisplay... I don't get the double drawing, but I also don't get UI updates. The view hierarchy looks like this:

BackgroundView (Opaque) -> (scrollview) -> RVTextView (Not Opaque) - > MagnetClipView (not Opaque, draws drop shadow) -> MagnetView (not opaque)
                                                                                   
                                     -> RVImageView (subclass of NSImageView)

So I set logging on all setNeedsDisplay... and drawRect methods in this hierarchy as well as logging on every time through the run loop (break,log & continue on __CFRunLoopRun) during a selection drag (the action that causes the double drawing effect) and this is what I get (cleaned up for readability). The thing I wonder about is the number of setNeedDisplayInRect: calls to BackgroundView--they all seem to be called from propagating dirty rect from non-opaque subviews though. Other than that I don't see anything that looks odd. Anyone?

**************Top of Run loop******************
17.617 RVApp[25760] BackgroundView: setNeedsDisplayInRect:{{18, 56}, {400, 16}} 17.618 RVApp[25760] BackgroundView: setNeedsDisplayInRect:{{18, 438}, {243, 32}} 17.618 RVApp[25760] BackgroundView: setNeedsDisplayInRect:{{18, 470}, {400, 24}}
17.619 RVApp[25760] BackgroundView: drawRect:
17.629 RVApp[25760] TextView: drawRect:
17.635 RVApp[25760] MagnetClipView: setNeedsDisplayInRect:{{0, 0}, {160, 200}}
17.636 RVApp[25760] MagnetClipView: drawRect:
17.638 RVApp[25760] MagnetClipView: setsNeedsDisplay:NO
17.638 RVApp[25760] RVImageView: drawRect:
17.649 RVApp[25760] MagnetView: drawRect:
17.653 RVApp[25760] BackgroundView: setsNeedsDisplay:NO
**************Top of Run loop******************
17.830 RVApp[25760] BackgroundView: setNeedsDisplayInRect:{{18, 72}, {400, 382}} 17.830 RVApp[25760] BackgroundView: setNeedsDisplayInRect:{{261, 454}, {157, 16}}
17.831 RVApp[25760] BackgroundView: drawRect:
17.842 RVApp[25760] TextView: drawRect:
17.848 RVApp[25760] MagnetClipView: setNeedsDisplayInRect:{{0, 0}, {160, 176}}
17.849 RVApp[25760] MagnetClipView: drawRect:
17.852 RVApp[25760] RVImageView: setNeedsDisplayInRect:{{0, 0}, {128, 128}} 17.852 RVApp[25760] MagnetView: setNeedsDisplayInRect:{{0, 0}, {160, 176}}
17.852 RVApp[25760] RVImageView: drawRect:
17.859 RVApp[25760] RVImageView: setsNeedsDisplay:NO
17.860 RVApp[25760] MagnetView: drawRect:
17.861 RVApp[25760] BackgroundView: setsNeedsDisplay:NO
17.862 RVApp[25760] MagnetClipView: setsNeedsDisplay:NO
17.862 RVApp[25760] MagnetView: setsNeedsDisplay:NO
**************Top of Run loop******************
18.075 RVApp[25760] BackgroundView: setNeedsDisplayInRect:{{18, 56}, {400, 16}} 18.075 RVApp[25760] BackgroundView: setNeedsDisplayInRect:{{18, 232}, {400, 144}} 18.075 RVApp[25760] BackgroundView: setNeedsDisplayInRect:{{18, 454}, {243, 16}} 18.075 RVApp[25760] BackgroundView: setNeedsDisplayInRect:{{18, 470}, {400, 24}}
18.076 RVApp[25760] BackgroundView: drawRect:
18.085 RVApp[25760] TextView: drawRect:
18.091 RVApp[25760] MagnetClipView: setNeedsDisplayInRect:{{0, 0}, {160, 200}}
18.091 RVApp[25760] MagnetClipView: drawRect:
18.094 RVApp[25760] MagnetClipView: setsNeedsDisplay:NO
18.094 RVApp[25760] RVImageView: drawRect:
18.101 RVApp[25760] MagnetView: drawRect:
18.102 RVApp[25760] BackgroundView: setsNeedsDisplay:NO
**************Top of Run loop******************
18.263 RVApp[25760] BackgroundView: setNeedsDisplayInRect:{{18, 72}, {400, 176}} 18.264 RVApp[25760] BackgroundView: setNeedsDisplayInRect:{{18, 376}, {400, 78}} 18.264 RVApp[25760] BackgroundView: setNeedsDisplayInRect:{{261, 454}, {157, 16}}
18.265 RVApp[25760] BackgroundView: drawRect:
18.275 RVApp[25760] TextView: drawRect:
18.281 RVApp[25760] MagnetClipView: setNeedsDisplayInRect:{{0, 0}, {160, 176}}
18.282 RVApp[25760] MagnetClipView: drawRect:
18.285 RVApp[25760] RVImageView: setNeedsDisplayInRect:{{0, 0}, {128, 128}} 18.285 RVApp[25760] MagnetView: setNeedsDisplayInRect:{{0, 0}, {160, 176}}
18.285 RVApp[25760] RVImageView: drawRect:
18.293 RVApp[25760] RVImageView: setsNeedsDisplay:NO
18.294 RVApp[25760] MagnetView: drawRect:
18.296 RVApp[25760] BackgroundView: setsNeedsDisplay:NO
18.298 RVApp[25760] MagnetClipView: setsNeedsDisplay:NO
18.298 RVApp[25760] MagnetView: setsNeedsDisplay:NO
**************Top of Run loop******************
18.460 RVApp[25760] BackgroundView: setNeedsDisplayInRect:{{18, 56}, {400, 16}} 18.460 RVApp[25760] BackgroundView: setNeedsDisplayInRect:{{18, 152}, {400, 32}} 18.460 RVApp[25760] BackgroundView: setNeedsDisplayInRect:{{18, 248}, {400, 128}} 18.460 RVApp[25760] BackgroundView: setNeedsDisplayInRect:{{18, 454}, {243, 16}} 18.460 RVApp[25760] BackgroundView: setNeedsDisplayInRect:{{18, 470}, {400, 24}}
18.461 RVApp[25760] BackgroundView: drawRect:
18.473 RVApp[25760] TextView: drawRect:
18.479 RVApp[25760] MagnetClipView: setNeedsDisplayInRect:{{0, 0}, {160, 200}}
18.479 RVApp[25760] MagnetClipView: drawRect:
18.481 RVApp[25760] MagnetClipView: setsNeedsDisplay:NO
18.481 RVApp[25760] RVImageView: drawRect:
18.489 RVApp[25760] MagnetView: drawRect:
18.490 RVApp[25760] BackgroundView: setsNeedsDisplay:NO
**************Top of Run loop******************

--
Ben Lachman
Acacia Tree Software

http://acaciatreesoftware.com

[EMAIL PROTECTED]
740.590.0009

On Feb 29, 2008, at 5:52 PM, Ken Ferry wrote:

I don't see a problem in your drawRect: code, so it'd be in something
you haven't posted.  Perhaps you could post a sample application?

One possibility is that your -isOpaque method returns YES, so the view
system thinks it doesn't have to redraw your superview before asking
you to draw.

If you're subclassing NSView, you'd have to opt-in to return YES from
-isOpaque, but if you're subclassing a deeper AppKit view class, it
may already be marked as opaque.

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to