Re: Design Question: Bindings & Custom Views
Re: Design Question: Bindings & Custom Views
- Subject: Re: Design Question: Bindings & Custom Views
- From: Erik Buck <email@hidden>
- Date: Fri, 29 Aug 2008 23:33:15 -0400
"Cocoa Design Patterns" Chapter 29, "Controllers," contains an MVC
solution to exactly the problem Oleg Krupnov describes. The chapter
presents a relatively simple MVC MYShapeDraw application. The chapter
leads the reader through the step by step process of re-inventing
NSArrayController as part of the MYShapeDraw application. The goal
is to highlight the rationale and use pattern for array controller and
other controllers. One of the reasons to use an array controller as a
mediator between model objects and views is precisely so that it's
easy to have multiple different views and potentially different
models. Therefore, the application provides multiple views. The
example even discusses sharing selection information by multiple views
or letting each view have a different notion of the current selection.
The application also uses the "Associative Storage" pattern from
chapter 19 to enable any view to store whatever extra information it
wants along with model objects. Categories are used to separate view
related code from the model code. Apple uses this approach in several
places to add view layer capabilities to model layer objects. See
NSString and NSStringAdditions.
_______________________________________________
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