I have an NSColorWell, which is bound to a property that contains an NSString instance, which get's transformed into an NSColor through my ColorTransformer (NSValueTransformer). It essentially transforms something like #FF0000 into an NSColor. This works as expected, but the ColorWell no longer opens it's Pane when clicked. When I disable the binding, it works again. Any clues to what I'm doing wrong here?
+1
A:
return YES in
+(BOOL)allowsReverseTransformation
the apple docs example has it return NO, however the default implementation has it return YES. The reasoning behind this is in theory simple enough: apple doesn't want your users to be able to set a color which will then crash the app (being that a reverse transform was not implemented). You should then probably implement
- (id)reverseTransformedValue:(id)value
to make sure this doesn't happen, if you haven't done so already. (If you don't apple's docs say it will call - (id)transformedValue:(id)value)
Jared P
2010-02-26 00:23:12
Kind of worked for me :) I'm handling everything inside of transformedValue based on a type check of value, but I guess I can use reverseTransformedValue in this case.
manufaktor
2010-02-26 19:42:48