Re: two things (newbie)
Re: two things (newbie)
- Subject: Re: two things (newbie)
- From: Shawn Erickson <email@hidden>
- Date: Thu, 10 Jun 2004 08:01:01 -0700
On Jun 10, 2004, at 7:12 AM, Rolando Abarca wrote:
On Wed, 9 Jun 2004, John Terranova wrote:
[self setNeedsDisplay:YES]; // ??
and what's the difference between that and [self display]?
The first thing is the right way and the second is the wrong way. :-)
Seriously what setNeedsDisplay does it marks things as being dirty and
hence needing to be redrawn. You can call this multiple times in a
given event loop on the same of differing view objects and the view
system will build up the set of things that needed to be redrawn. Then
when the event comes around to it all of the dirty things will be drawn
in a more optimized phase and only once. If you call display you can
easily incur over drawing, etc.
So the right way is to use setNeedsDisplay: or better yet
setNeedsDisplayInRect:. The view system will call displayIfNeeded, etc.
for you then.
Apple has several online topics about the view system in AppKit, you
can jump into them from the NSView API page. One relevant to you
question is the following...
<
http://developer.apple.com/documentation/Cocoa/Conceptual/DrawViews/
Tasks/DisplayingViews.html>
-Shawn
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.