On Jun 29, 2009, at 15:23, Michael de Haan wrote:

Given this simple app....which keeps a slider and textField's value synchronized.

1) View consisting of a slider and a textField
2) Model (Foo) with a single property "number"
3) NSObjectController

I am able to use 2 configurations to get the app to work.


Config (1).

In IB, Bind the textField's and Slider's values to the model Key Path "selection.number".
Connect the NSOjectController's outlet ( cntrl-drag to foo).


Config (2)

As config (1) ...first line only.... now Bind NSObjectController to Foo, with the model Key Path = self.


Could someone please explain why both work, and any reason for choosing one over the other.

Is File's Owner of class Foo? (I'm not sure how you'd bind to Foo otherwise.) If so, the two methods are exactly identical.

Method (1) is what you'd normally use for objects inside the NIB file. Method (2) is what you'd normally use for objects not in the NIB file. File's Owner is not actually in the NIB file, but it pretends to be, so you have a choice.


_______________________________________________

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