Re: IBOutlets or property + binding
Re: IBOutlets or property + binding
- Subject: Re: IBOutlets or property + binding
- From: Christian Ziegler <email@hidden>
- Date: Thu, 19 Nov 2009 22:52:57 +0100
target/action is inappropriate since no action is needed at the time the value was changed. Instead, once the user clicks a button I compute something hence I read the values from the steppers and stuff. But that doesn't change much does it :)
Cheers,
Chris
On 19.11.2009, at 18:51, Karolis Ramanauskas wrote:
> 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 <email@hidden>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 (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
_______________________________________________
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