NSValueTransformer used with table colulms
NSValueTransformer used with table colulms
- Subject: NSValueTransformer used with table colulms
- From: Mike Thorpe <email@hidden>
- Date: Thu, 25 Mar 2004 11:12:40 +0100
I have a problem using a an NSValueTransformer on a bound table column.
The data to be displayed in the column is an NSNumber, which by default
displays as 0 or 1, or with a checkbox as a checked or unchecked
checkbox.
However I would like to display it as as string: @"" (for zero values)
and as @"C" (for non-zero values). This is what my transformer does:
+ (Class)transformedValueClass
{
return [NSString class];
}
- (id)transformedValue:(id)value
{
NSNumber *n = value;
if ([n boolValue])
return @"C";
return @"";
}
When it runs I get garbage in the column for non-zero values. It seems
as if the NSTableView still thinks it's an NSNumber instead of an
NSString. Interestingly, the "transformedValueClass" method never gets
called.
Can anyone throw any light on this? thanks in advance for any help.
Mike Thorpe.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.