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 protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to