|[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]|
The recent thread on MVC class design got me thinking about MVC separation_______________________________________________
in my own app. I have a menu item action connected to the First Responder in
MainMenu.nib. The action method programmatically changes the contents of an
Currently, I have the action method implemented in an NSTextView subclass. I
subclassed NSTextView for another reason altogether, but I figured since I
already have a subclass, I might as well implement the action method in it.
After reading Apple's documentation on application architecture, which
states that logic specific to an application should be implemented in
controller objects, I'm thinking that the action method should be
implemented in the text view's window controller instead.
What are the advantages and disadvantages of each approach? Implementing the
action method in the NSTextView subclass seems more direct to me, in the
sense that it is the object whose contents need to be changed, so it should
respond to the menu action, rather than waiting for it to travel up the
responder chain to the window controller.
As a side question, should I not be making changes to the text view at the
NSTextView level at all since it is a view object? I.e. Should I subclass
NSTextStorage, NSTextView's model class, and make the changes there?
Can anyone shed some light on this? Thanks.
cocoa-dev mailing list | email@hidden
Do not post admin requests to the list. They will be ignored.
|>MVC and Cocoa text system (From: Eric <email@hidden>)|
Visit the Apple Store online or at retail locations.
Copyright © 2011 Apple Inc. All rights reserved.