Re: Reverse value transformation with different class?
Re: Reverse value transformation with different class?
- Subject: Re: Reverse value transformation with different class?
- From: Tom Harrington <email@hidden>
- Date: Wed, 23 Nov 2005 11:11:17 -0700
On 11/23/05, Wain <email@hidden> wrote:
> On 23 Nov 2005, at 17:20, Tom Harrington wrote:
> > I need to implement a value transformer that will convert a string
> > representation of a color into an NSColor and back, for purposes of
> > bindings.
>
> This is possible, look at:
>
> http://developer.apple.com/documentation/Cocoa/Conceptual/
> ValueTransformers/index.html
>
> Specifically the "Writing a Custom Value Transformer" section.
That's the part I was looking at.
> I would suggest however that you simply convert the NSColor to NSData
> and back, it's much easier...
I know, but I have other requirements where I really need a string
representation. I didn't just dream up the conversion to string. :-)
> > The documentation on writing a custom value transformer says that +
> > transformedValueClass must return "the class of the object that both
> > the transformedValue: and reverseTransformedValue: methods will
> > return."
>
> The documentation actually states: "Returns the class of the value
> returned by the transformer. Subclasses should override this method
> and return the appropriate class."
> The whole point is to transform from one type to another. :-)
The documentation for NSValueTransformer says that. But the "Value
Transformers Programming Guide" at
<http://developer.apple.com/documentation/Cocoa/Conceptual/ValueTransformers/Concepts/CustomTransformer.html#//apple_ref/doc/uid/20002167>
reads as I quoted above, which is why I asked about it.
--
Tom Harrington
email@hidden
AIM: atomicbird1
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden