On Jul 1, 2009, at 8:03 AM, Michael de Haan wrote:

"I have previously used the content outlet to establish a connection between NSObjectController and its object. Is contentObject an alternative way to do the same thing"

and the best reply by mmalc:

"If you set the contentObject of an object controller, then -- just as
anywhere else in Cocoa -- you're setting one of its properties
(typically an instance variable) and it's then the recipient's
responsibility to look after it.
............
If you bind the contentObject, they you're telling it to keep it
synchronised with whatever is at the end of the keypath you provided
from the source object."

So, when I emulated the currency converter, with bindings, I was surprised when they connected the NSObjectController to the model using the content outlet of NSObjectController, as per the above discussion. ( What I **expected** (clearly incorrectly) was that, in order for the project to work, one would have to bind the view to the controller, then bind the controller to the model). So, I was puzzled when **both** approaches worked ie binding the view to the controller, and **either** binding the controller to the model ( with keypath "self") OR setting the controller's content to the view. (Cntrl-dragging from the controller to the model).

It might well be possible that I am thinking about the bindings incorrectly...and in fact all one needs in this case is to bind the view( textfield and slider) to the controller with the correct keypath, and that the relationship of a controller to it's content is the issue I am not completely understanding.

Binding only involves two endpoints (objects). That there are additional inter-object connections involved in a design is a design issue and not inherent to bindings in any way. So it is irrelevant to the view-controller bindings how the controller gets its content, and there are multiple ways this can be done.

It appears that you are assuming that bindings involves three objects ion an MVC pattern. MVC is a design pattern, bindings are only one way to "connect" objects, such as M-C or V-C, but are not themselves an implementation of MVC.


Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to