Optimizing NSView's drawRect
Optimizing NSView's drawRect
- Subject: Optimizing NSView's drawRect
- From: David Chan <email@hidden>
- Date: Thu, 24 Nov 2005 12:00:38 +0800
Hi all,
I have got a NSView which basically draw a shelf with books a la delicious
library. I provide the zooming function for user using NSSlider and user can
also resize the window. I notice that after zooming in and out, resizing
windows and scrolling up and down for a while, my program would tend to slow
down and sort of hang a bit, though it never crashes so far. It also take
considerably longer time to close upon quitting.
I have untick the 'continuously send action while sliding' option from
NSSlide to lessen the call for redrawing on zooming but when it comes to
resizing window and scrolling, there is nothing I can do- drawRect seems to
get called numerous times as user scroll.
And my drawRect is inevitably a costly method to call as I would have to
travel through my array of book collection, defining the coordinate and draw
it one by one.
I am still strugling with the 'release' part of obj-C as I have been using
Java all this while, so I may have lots of object unreleased within my
function too. I don't know if that could result in the above problem.
Any idea how I should optimize my program or what could possibly went wrong
with my program? Thanks alot..
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