• 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: Additional action when a view's value changes (Cocoa Bindings)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Additional action when a view's value changes (Cocoa Bindings)


  • Subject: Re: Additional action when a view's value changes (Cocoa Bindings)
  • From: Christian Ziegler <email@hidden>
  • Date: Thu, 10 Dec 2009 12:45:25 +0100

I think mmalc got me right. Sorry again for my initial mail which was a little confusing. When I wrote the mail I confused Cocoa Bindings with target/action, because what I've been doing is, I just connected the selector of one view TextField)  to the takeIntegerFrom IBAction of another one (Stepper) and vice versa. Actually I'm pretty sure I read this in a book.

Anyways, obviously this is bad practice and I've been doing it "right", I was just wondering whether there is a more convenient way since I got 4 pairs of Steppers/TextFields in my app. My action method looks kind of like

if (sender == firstStepper) {...}
else if (sender == secondStepper) {...}
...

In the target controller I don't have IBOutlets for those steppers and textfields. Those are in another (mediating) controller. Question is whether there is another way to do this instead of defining outlets also in the target controller. I guess assigning tags to each stepper/textfield and defining an enum for them would be an option?

Cheers,
Chris

On 10.12.2009, at 02:41, mmalc Crawford wrote:

>
> On Dec 9, 2009, at 5:47 am, Christian Ziegler wrote:
>
>> Sorry I got to correct myself, it's not Cocoa Bindings, but direct target/action. So I connected the takeIntegerValue action of both views to each other in contrast to connecting it to a controller.
>>
> Don't do that.
> Both should invoke an action in a controller, which may then update views and models appropriately.
>
> You should read <http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CocoaFundamentals/> and in particular "The Model-View-Controller Design Pattern" <http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CocoaFundamentals/CocoaDesignPatterns/CocoaDesignPatterns.html#//apple_ref/doc/uid/TP40002974-CH6-SW1> which is crucial for all Cocoa development.
>
> mmalc
>
> _______________________________________________
>
> 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

  • Follow-Ups:
    • Re: Additional action when a view's value changes (Cocoa Bindings)
      • From: Graham Cox <email@hidden>
References: 
 >Additional action when a view's value changes (Cocoa Bindings) (From: Christian Ziegler <email@hidden>)
 >Re: Additional action when a view's value changes (Cocoa Bindings) (From: Christian Ziegler <email@hidden>)
 >Re: Additional action when a view's value changes (Cocoa Bindings) (From: mmalc Crawford <email@hidden>)

  • Prev by Date: Re: Quastion about types in a NSPasteBoard
  • Next by Date: Re: Quastion about types in a NSPasteBoard
  • Previous by thread: Re: Additional action when a view's value changes (Cocoa Bindings)
  • Next by thread: Re: Additional action when a view's value changes (Cocoa Bindings)
  • Index(es):
    • Date
    • Thread