• 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
Re: Reverse value transformation with different class?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Reverse value transformation with different class? (From: Tom Harrington <email@hidden>)
 >Re: Reverse value transformation with different class? (From: Wain <email@hidden>)

  • Prev by Date: [FIXED] CoreData Fetch Request Failing When Using NSDate in NSPredicate
  • Next by Date: Re: CIImage slower than NSImage?
  • Previous by thread: Re: Reverse value transformation with different class?
  • Next by thread: Re: Reverse value transformation with different class?
  • Index(es):
    • Date
    • Thread