• 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: infoForBinding not working as expected
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: infoForBinding not working as expected


  • Subject: Re: infoForBinding not working as expected
  • From: Ken Thomases <email@hidden>
  • Date: Sat, 21 Feb 2009 07:08:04 -0600

On Feb 21, 2009, at 5:57 AM, David Niemeijer wrote:

I have an NSImageView and in IB have set it up so that it binds on "Value Path". Everything works fine, but when I subclass NSImageView and in my subclass want to get info about the binding and use [self infoForBinding:@"Value Path"] (or when I instead have bound to "Valueurl" use [self infoForBinding:@"Valueurl"]) the result is NULL. Does IB name the bindings differently?

Yes, IB is presenting "display names" for the bindings. The bindings for AppKit-provided classes are documented, using their real names, in the Cocoa Bindings Reference:
http://developer.apple.com/documentation/Cocoa/Reference/CocoaBindingsRef/


The page for NSImageView shows bindings called "valuePath" and "valueURL". (In general, AppKit uses naming conventions similar to those for property names for its bindings.)

The NSKeyValueBindingCreation protocol reference documents string constants for AppKit-defined bindings. So, for the above two bindings, you should use NSValuePathBinding and NSValueURLBinding.


Is there a way to query an object and get back an array of current binding names?

A class _may_ expose its bindings through the -exposedBindings and +exposeBinding: methods, but this is optional. It's not required to make a binding work, but it does allow IB to know about the binding.


Cheers,
Ken

_______________________________________________

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


References: 
 >infoForBinding not working as expected (From: David Niemeijer <email@hidden>)

  • Prev by Date: Programmatically opening an NSComboBox list
  • Next by Date: RE: How to get the "white shadow" effect when drawing NSStrings?
  • Previous by thread: infoForBinding not working as expected
  • Next by thread: Programmatically opening an NSComboBox list
  • Index(es):
    • Date
    • Thread