• 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: Using NSValueTransformer to convert NSImage to NSData
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using NSValueTransformer to convert NSImage to NSData


  • Subject: Re: Using NSValueTransformer to convert NSImage to NSData
  • From: "I. Savant" <email@hidden>
  • Date: Tue, 24 Mar 2009 10:18:26 -0400

On Tue, Mar 24, 2009 at 8:39 AM, Peter Zegelin
<email@hidden> wrote:

>        [value description] gives just  a string <................> with
> nothing obvious in it.

  This is basic Cocoa 101:

http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/CocoaObjects/CocoaObjects.html

  Also look at the -description method here:

http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Protocols/NSObject_Protocol/Reference/NSObject.html


> So how do I  transform whatever value is into an NSData object for
> archiving?

  You haven't mentioned whether you've read this:

http://developer.apple.com/documentation/Cocoa/Conceptual/ValueTransformers/ValueTransformers.html

  Essentially, you should already know what kinds of objects to
expect, what to convert, and what to ignore. If you expect to receive
more than one type (and you shouldn't with an NSImageView, since it
won't let you insert anything other than an NSImage or nil), then you
can ask it for its -class or -className to figure out what it is and
what to do with it.

  In your case, you should probably only be checking for nil (and
returning nil or the [NSNull null] placeholder in kind) or, if it's an
image, archive it and return the NSData object, or vice-versa
(depending on which direction is "reverse" for you).

  Since you haven't provided a full code listing, I can't tell if
you're missing anything else.

--
I.S.
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Using NSValueTransformer to convert NSImage to NSData
      • From: Peter Zegelin <email@hidden>
References: 
 >Using NSValueTransformer to convert NSImage to NSData (From: Peter Zegelin <email@hidden>)

  • Prev by Date: Using NSValueTransformer to convert NSImage to NSData
  • Next by Date: Re: iPhone Tab bar Question
  • Previous by thread: Using NSValueTransformer to convert NSImage to NSData
  • Next by thread: Re: Using NSValueTransformer to convert NSImage to NSData
  • Index(es):
    • Date
    • Thread