A O A O - 1 month ago 13
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

self
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

Yes, you can access the transformer:

options = [[textfield infoForBinding:NSValueBinding] objectForKey:NSOptionsKey];
valueTransformer = [options objectForKey:NSValueTransformerBindingOption];
Comments