• 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: How do I save and restore a custom NSTextAttachmentCell?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How do I save and restore a custom NSTextAttachmentCell?


  • Subject: Re: How do I save and restore a custom NSTextAttachmentCell?
  • From: Douglas Davidson <email@hidden>
  • Date: Wed, 16 Nov 2005 10:54:27 -0800


On Nov 16, 2005, at 8:19 AM, Michael wrote:

I successfully build a custom NSTextAttachmentCell subclass to handle some own image representation. I'm able to add a attachment using this cell to a text view programatically.

What do I need to do to save and restore my custom data and instantiate my custom class? I would like to use my own data (some strings and integers) instead of using the NSFileWrapper hold by NSTextAttachment.


Probably the most convenient thing would be to store your strings and integers in an NSData suitable for considering as the contents of a file, from which you can create an NSFileWrapper. An archive or a plist would be a simple way of doing this. You would probably want to pick a suitable extension to distinguish the names of these files.


An alternative would be to define a custom subclass of NSTextAttachment that would store your custom data rather than an NSFileWrapper. However, this would not work when saving the attributed string to standard formats like RTFD; instead, you would need to archive the attributed string (and support coding in your custom subclass).

Douglas Davidson

_______________________________________________
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


  • Follow-Ups:
    • Re: How do I save and restore a custom NSTextAttachmentCell?
      • From: Michael <email@hidden>
References: 
 >How do I save and restore a custom NSTextAttachmentCell? (From: Michael <email@hidden>)

  • Prev by Date: Re: API to determine the location of a NSFont's .ttf file
  • Next by Date: Re: Password
  • Previous by thread: How do I save and restore a custom NSTextAttachmentCell?
  • Next by thread: Re: How do I save and restore a custom NSTextAttachmentCell?
  • Index(es):
    • Date
    • Thread