Arghh... I was beaten to an answer! :) Slow typing...

Yeah, with bindings you will get a two-way connection. If you change your
property's value programmatically, the stepper will update also.

Instead of target-action you could set up an iboutleted property, connect
stepper to it and observe that property for changes. This may be a more
cumbersome approach in this case though.

Karolis

On Thu, Nov 19, 2009 at 11:45 AM, Keary Suska <cocoa-...@esoteritech.com>wrote:

> On Nov 19, 2009, at 10:32 AM, Christian Ziegler wrote:
>
> > For instance I got a NSStepper and I only need the integerValue of that
> stepper. I could either define an IBOutlet and access the integerValue with
>  [stepper integerValue], or I could define a property and bind the steppers
> value to it. As I mentioned I don't have to manipulate that stepper in any
> way, I really only need the value. I just wanna know what's best practice.
>
> Bindings are generally used to synchronize between a model object and view.
> When considering a one-way actions, I generally use IBOutlets to manipulate
> a view, but use target-action for passive activities. So, if it were me, and
> all I cared about was what value an NSStepper was set to, I would just set
> the target/action to my controller object and read the value in the action.
> Although in this case I would set autorepeat to NO so my method is only
> called once.
>
> HTH,
>
> 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