Re: outlets to multiple views (NSView)
Re: outlets to multiple views (NSView)
- Subject: Re: outlets to multiple views (NSView)
- From: Aaron Boothello <email@hidden>
- Date: Wed, 25 Oct 2006 18:14:48 +0800
ive been implementing notifications into my code.
after registering different views as 'observers' of my model. if i
change the model from any of the views, do i need to 'post A
Notification' in order for the other views to be updated ? or is this
supposed to happen automatically when the model is changed ? tring to
get this to work, so was wondering what the chain of events and
behavior 'should' be.
Cheers,
Aaron
On 25/10/2006, at 4:22 PM, Uli Kusterer wrote:
Am 25.10.2006 um 08:23 schrieb Aaron Boothello:
When i started programming in Cocoa, i started using the MVC
paradigm. My application is mostly openGL based within the Cocoa
API. When i first started it was recommended that combining the
view&controller. What do you guys reckon ? i dont have any problem
splitting them apart....would it be beneficial ? cause the OpenGL
views do have to interact with the UI.
Well, it isn't really MVC if you combine view and controller.
There are some cases where you may want to split up the controller
into a view-controller and a model-controller, but marging the
controller into the view or the model destroys most of the
advantages of MVC.
Now, keep in mind, in general it's OK to call setNeedsDisplay:
directly on you view, and to have the view tell your controller
*directly* what it wants, but if you have several views accessing
the same model, through the same controller, that no longer is a
good idea.
It's just a matter of using the right tool for the right job.
One thing that helps me often, is to think what parts I would have
to replace if I wanted to change my file format (e.g. from XML to
SQL or whatever). Most of those parts would be what belongs in the
model. OTOH if I wanted to turn this thing into a command-line
tool, the parts I'd have to replace would be the "View" part of MVC.
Does that help?
Cheers,
-- M. Uli Kusterer
http://www.zathras.de
_______________________________________________
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