On 23/01/2010, at 2:19 AM, [email protected] wrote: > I see the same behaviour when subclassing NSNumberFormatter. > - (NSString *)stringForObjectValue:(id)anObject always receives an NSNumber. > > If you subclass NSFormatter directly then you can probably gain the control > you need and detect the underlying object type. > > http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/DataFormatting/Articles/CreatingACustomFormatter.html
Ah, thanks - that was the push in the right direction I needed. Turns out if I override: - (NSAttributedString *) attributedStringForObjectValue:(id) anObject withDefaultAttributes:(NSDictionary*) attributes; then <anObject> is a string if it has been explicitly set as a string, so I can detect that and return it instead of converting it to a number. It doesn't get nil if I set nil, that is converted to a number = 0 earlier it seems. But this is good enough - I can set a string for the mixed value. thanks! --Graham _______________________________________________ Cocoa-dev mailing list ([email protected]) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
