Re: Question about NSTreeController/NSOutlineView instance cleanup
Re: Question about NSTreeController/NSOutlineView instance cleanup
- Subject: Re: Question about NSTreeController/NSOutlineView instance cleanup
- From: mmalc crawford <email@hidden>
- Date: Fri, 11 Apr 2008 23:50:11 -0700
On Apr 11, 2008, at 12:10 AM, Quincey Morris wrote:
For another thing, assuming you're approaching this using MVC design
principles, this code gets things exactly backwards -- when setting
up your data model, you don't make changes to the controller and
expect them to be reflected in the model -- you make changes in the
model and let them be reflected (via the controller) in the view.
This is at best misleading.
It is perfectly reasonable to make changes to the controller an expect
them to be propagated to the underlying model. You do this. for
example, when invoking an array controller's add: or insert: method.
It's not clear what the relevance is of mentioning the MVC pattern
here -- controllers do manipulate the model object graph.
Well, without knowing the details of what you're doing, it's
impossible to be certain, but this code certainly looks *very*
wrong. For one thing, 'insertObject' is (according to the
documentation) for controller subclasses to use to customize their
own behavior, not for other things to use to insert objects.
Normally, you don't want to mess with trying to change
arrangedObjects directly.
On the contrary, insertObject:atArrangedObjectIndex: is provided
precisely so that you can add an object at a particular location.
See Bookmarks at <http://homepage.mac.com/mmalc/CocoaExamples/controllers.html
> for an example.
mmalc
_______________________________________________
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