• 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: JArod Wen <email@hidden>
  • Date: Wed, 23 Jul 2008 12:19:53 -0400

Ken you are right. Fortunately I set isOpaque to be YES in my view. I added the lines Graham had written before and now it is working perfectly!

Thanks buddies for all your help!

On Jul 23, 2008, at 2:04 AM, Ken Ferry wrote:

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

--------------- JArod Wen




_______________________________________________

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


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>)
 >Re: Problem on clearing points and paths on a NSView (From: "Ken Ferry" <email@hidden>)

  • Prev by Date: Re: Inverse Regex Library?
  • Next by Date: Re: NSLog on releasebuild
  • 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