• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Problem on clearing points and paths on a NSView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem on clearing points and paths on a NSView


  • Subject: Re: Problem on clearing points and paths on a NSView
  • From: "Ken Ferry" <email@hidden>
  • Date: Tue, 22 Jul 2008 23:04:10 -0700

On Tue, Jul 22, 2008 at 9:06 PM, Jens Alfke <email@hidden> wrote:
>
> As Graham pointed out, the reason your shapes don't get erased is that you
> don't erase them. Your -drawRect method needs to begin by clearing the
> passed-in NSRect to the background color, otherwise you may be leaving
> behind the old contents of the view.

Er, perhaps I'm missing something relevant (and I haven't really
reviewed the original poster's code), but this is not in general true.

When a region of a window needs to be redrawn, Cocoa clears the dirty
region of the window, then draws each view that overlaps that region
in turn, bottom to top.  As an optimization, if a view covers the
region and returns YES to -[NSView isOpaque], then Cocoa does not
bother to clear the window or draw anything under that view, since
that view has pledged to completely cover the drawing anyway.

But unless you've pledged that you're opaque by returning YES from
isOpaque, you should not need to explicitly fill your bounds in
drawRect:.

-Ken
Cocoa Frameworks
_______________________________________________

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

  • Follow-Ups:
    • Re: Problem on clearing points and paths on a NSView
      • From: JArod Wen <email@hidden>
References: 
 >Problem on clearing points and paths on a NSView (From: JArod Wen <email@hidden>)
 >Re: Problem on clearing points and paths on a NSView (From: Jens Alfke <email@hidden>)
 >Re: Problem on clearing points and paths on a NSView (From: JArod Wen <email@hidden>)
 >Re: Problem on clearing points and paths on a NSView (From: Jens Alfke <email@hidden>)

  • Prev by Date: Re: NSConnection Issue
  • Next by Date: Re: Returning exactly what has been promised
  • Previous by thread: Re: Problem on clearing points and paths on a NSView
  • Next by thread: Re: Problem on clearing points and paths on a NSView
  • Index(es):
    • Date
    • Thread