Re: drawRect troubles
Re: drawRect troubles
- Subject: Re: drawRect troubles
- From: Uli Kusterer <email@hidden>
- Date: Sun, 29 Oct 2006 12:02:01 +0100
Am 29.10.2006 um 04:33 schrieb Ivan Kourtev:
I was under the impression that what's been drawn in the view so
far is there, and if I don't want it, I have to erase it. So I am
only adding small pieces of stuff in drawRect -- and they do appear
on screen. All of the previous drawing is gone.
That impression isn't quite correct. You get an update message for
what you invalidate. Invalidate less if you need to redraw less.
Since I am issuing the [self setNeedsDisplay:YES] is there any way
to also specify which particular parts of the view should be
invalidated?
-setNeedsDisplayInRect: -- it really helps to read the headers,
related methods are usually next to each other, so you could have
seen that method and option-doubleclicked it to see the docs.
Right now, the argument to drawRect is always the entire view area.
Note that, if this is a case where drawing is really slow, you can
get a list of the actual "sub-rectangles" that really need updating
from NSView and only update those, because for the cases where you
have e.g. a small rect in the top left and another in the bottom
right of your view, drawRect:'s parameter will be the union of the
two rectangles.
Cheers,
-- M. Uli Kusterer
http://www.zathras.de
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden