Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSValueTransformer used with table colulms



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.




Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.