• 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 an objects "Enabled" to a button in IB
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Binding an objects "Enabled" to a button in IB


  • Subject: Re: Binding an objects "Enabled" to a button in IB
  • From: Jerry Krinock <email@hidden>
  • Date: Mon, 30 Aug 2010 17:29:57 -0700

On 2010 Aug 30, at 05:42, Joanna Carter wrote:

> The usual way to handle this would be to have a simple boolean property on the controller class…

True, but let's answer the poster's question,

> Le 30 août 2010 à 13:26, email@hidden a écrit :
>
>> Can this binding be done … completely in the nib file (in IB)?

The answer is yes because the controller Joanna refers to may be an NSObjectController from the Library in IB.

Because the "Bind to" popup in Interface Builder's Inspector ▸ Bindings only shows the "controller" objects to which controls are typically bound, you cannot bind the Enabled binding of a text field directly to, say, the state of a button in Interface Builder.  But sometimes Apple leaves little hooks for "the other 20%" of us to do it Our Way.  Drop in an NSObjectController, and bind the text field's Enabled binding instead to the object controller with Controller Key = "content".  Then, bind the Value binding of the button to the same object controller with same Controller Key = "content".  Voila.

A similar arrangement allows one to codelessly bind a tab view's selected item to a segmented control.

Establishing bindings which IB doesn't sanction like this is one of the two uses I've discovered for what I once thought was a rather lame device.  In this case, think of NSObjectController as a RCA-phono to phone-plug adapter.

_______________________________________________

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: Binding an objects "Enabled" to a button in IB
      • From: Joanna Carter <email@hidden>
References: 
 >Binding an objects "Enabled" to a button in IB (From: email@hidden)
 >Re: Binding an objects "Enabled" to a button in IB (From: Joanna Carter <email@hidden>)

  • Prev by Date: Re: Simple instance [[alloc] init] question.
  • Next by Date: Re: core data issues iOS 4.0.2
  • Previous by thread: Re: Binding an objects "Enabled" to a button in IB
  • Next by thread: Re: Binding an objects "Enabled" to a button in IB
  • Index(es):
    • Date
    • Thread