• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSValueTransformer used with table colulms
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


  • Follow-Ups:
    • Re: NSValueTransformer used with table colulms
      • From: mmalcolm crawford <email@hidden>
  • Prev by Date: Re: Returning structs of NSStrings
  • Next by Date: Re: Returning structs of NSStrings
  • Previous by thread: Re: Returning structs of NSStrings
  • Next by thread: Re: NSValueTransformer used with table colulms
  • Index(es):
    • Date
    • Thread