Re: Design question: View with hell lot of drawing
Re: Design question: View with hell lot of drawing
- Subject: Re: Design question: View with hell lot of drawing
- From: Graham Cox <email@hidden>
- Date: Tue, 10 Mar 2009 19:59:23 +1100
On 10/03/2009, at 7:39 PM, rajesh wrote:
Is there any other way of approach, or should I be making use of one
of the ways I mentioned ?
Of course - just define a custom object that contains or manages each
piece of content and draw them in one view. This is the "classic"
approach and is probably the most scalable technique of all, since it
incurs no overhead other than what you add.
The simplest approach is just to hold all the objects in a list and
when the view is updated, traverse the list and determine which
objects need to be drawn. The view itself has methods to keep this to
a minimum -needsToDrawRect: and -getRectsBeingDrawn:count: For large
numbers of objects (>1000, but YMMV) traversing the list testing for
"needs to be drawn" itself becomes significant, in which case you'll
need to consider alternative architectures such as binary search
partitioning or R*-trees.
My own DrawKit project includes classes for dealing with this problem. http://apptree.net/drawkit.htm
(though right now the implementation in the current download is a
bit buggy - I have a new version going out soon that fixes these
issues).
--Graham
_______________________________________________
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