• 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: Binding different elements of an UI.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Binding different elements of an UI.


  • Subject: Re: Binding different elements of an UI.
  • From: Chris Hanson <email@hidden>
  • Date: Sat, 2 Sep 2006 22:01:12 -0700

On Sep 2, 2006, at 9:52 AM, Keith Penrod wrote:

I'm wondering if there's a way to bind the different elements of a UI together. (For example, have a NSTextField that is visible only when a certain checkbox is checked or radio button selected.) Would I have to make an outlet for a controller or the document and connect the checkbox to the outlet and a "toggle" action or something?

The best thing to do is change the way you're thinking about the problem. There's a clue in the language above: "An NSTextField that is visible only when a certain checkbox is checked or radio button selected."


Instead, think of it as binding the text field's visibility to a condition. Now what do you use to change the condition? A checkbox or radio button selection. So those are *also* bound to the same attribute, or some attribute that feeds into that condition.

Breaking the problem apart in this fashion -- hooking views to a data model, rather than hooking views to each other -- will help lead you to good MVC application design more often than not. And everything in Cocoa is built on an MVC architecture, so you'll be going with the grain of the framework if you do so.

  -- Chris

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Binding different elements of an UI. (From: "Keith Penrod" <email@hidden>)

  • Prev by Date: Re: How to make Metronome?
  • Next by Date: Re: Question about categories
  • Previous by thread: Re: Binding different elements of an UI.
  • Next by thread: Re: Binding different elements of an UI.
  • Index(es):
    • Date
    • Thread