A O A O - 1 year ago 72
Objective-C Question

Is it possible to programmatically access the NSValueTransformer associated with my cocoa binding?

The reason isn't important, because I know this is bad, but it's just for curiosity. The better way, what we are going to do is just have the transformer access a shared instance to update a

property, instead of somebody else setting it on the transformer.

But is there any way to access the options on a cocoa binding programmatically, and more specifically, access the current transformer?

Answer Source

Yes, you can access the transformer:

options = [[textfield infoForBinding:NSValueBinding] objectForKey:NSOptionsKey];
valueTransformer = [options objectForKey:NSValueTransformerBindingOption];
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download