• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSObjectController, content outlet and content object question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSObjectController, content outlet and content object question


  • Subject: Re: NSObjectController, content outlet and content object question
  • From: Keary Suska <email@hidden>
  • Date: Wed, 1 Jul 2009 09:45:40 -0600

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 (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


  • Follow-Ups:
    • Re: NSObjectController, content outlet and content object question
      • From: Michael de Haan <email@hidden>
References: 
 >Re: NSObjectController, content outlet and content object question (From: Michael de Haan <email@hidden>)

  • Prev by Date: Re: GC bug in NSFontManager?
  • Next by Date: Looking for a Mentor in the SF Bay Area
  • Previous by thread: Re: NSObjectController, content outlet and content object question
  • Next by thread: Re: NSObjectController, content outlet and content object question
  • Index(es):
    • Date
    • Thread