Re: Question regarding NSView's drawRect
Re: Question regarding NSView's drawRect
- Subject: Re: Question regarding NSView's drawRect
- From: Dominik Pich <email@hidden>
- Date: Mon, 30 Oct 2006 09:21:20 +0100
DrawRect will be called whenever at least a portion of a view is
visible (e.g. if it WAS hidden by an overlapping window)
Try not to intercept those calls but always honor draw requests.
If you really draw the same very often, cache your drawing in an
NSImage and then blit only that onscreen.
Regards,
Dominik
Am Oct 30, 2006 um 8:28 AM schrieb David Chan:
Hi all, I have a question regarding NSView. I have an application that
keep many subclassed NSView objects. Users shall be able to navigate
around and depending on their action, certain NSView objects will be
shown and other will be hidden or moved to other window
Now.. I actually only need to use drawRect once for every object -
when I first created the objects. I will neither need to scroll nor do
anything that will require redrawing of the NSView objects. By right,
it should be safe to release all the image data objects I use after
the drawRect returns; and that is my intention in order to minimize
the memory usage. But it seems that there are certain occasions where
the Application would call drawRect on its own. This will be a problem
because all the image data will no longer be there.
So my question is.. Is it possible for me to intercept this so that
the drawRect will not be called? Or maybe there can be other
workaround so that my App will not need to redraw the NSView
unnecessarily?
Thanks a lot for your attention.
Regards,
David
_______________________________________________
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
_______________________________________________
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