Re: Advice on building a complex user custom control
Re: Advice on building a complex user custom control
- Subject: Re: Advice on building a complex user custom control
- From: Paul Bruneau <email@hidden>
- Date: Mon, 2 Mar 2009 08:22:04 -0500
On Mar 1, 2009, at 8:22 PM, Oliver Charles wrote:
At the moment, I have a main MapView control, which creates vertices
in an NSArrayController. I have 2 ways of viewing these vertices - one
is to handle rendering them directly in the MapView, and another
approach creates a new VertexView for each vertex, and adds it as a
subview of the MapView. From what I've read online, this is not going
to scale beyond maybe 50 vertices, so I don't think this is an
approach. However, handling *everything* in the MapView itself feels
like it drastically reduces the cohesion of the control.
I'm not sure what you mean by this. What could be more cohesive than
handling all your drawing and manipulation in MapView? Maybe cohesive
wasn't the word you were looking for or maybe I am misunderstanding.
You can have your vertices contain their own drawing code (you will
make them know how to draw themselves), but many will say that is a
violation of MVC practices. But Erik Buck once told me a way that I
really like: "If you are worried about adding drawing code to a
"Model" object, add the drawing code in a category of <your model's
class> and maintain the category implementation in the "View"
subsystem."
Then you can have things such as [aVertex draw] or [aVertex
drawWithHighlight] etc, called from the drawRect: method of your view.
_______________________________________________
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