• 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: Thu, 17 Nov 2005 09:44:04 -0800


On Nov 17, 2005, at 7:00 AM, Michael wrote:

That sounds good. But one question left to solve this puzzle for me: How do I load this data (RTFD + own data file) back into a NSTextView and instantiate my own NSTextAttachmentCell-subclasses? I assume I have to scan the attributed string and replace the cells of my custom attachments with instances of my own cell classes? Is this right or is there a more appropriate way?


If you simply load the RTFD in the usual way, you will get NSTextAttachments with the contents of your custom file types. Remember that by default NSTextAttachment will, on demand, create a default NSTextAttachmentCell based on its idea of the contents of the file--in this case, that would probably just be an icon. If you want instead to use a custom image or a custom cell, you can scan through the attributed string looking for the NSAttachmentAttributeName attribute, check to see whether the attachment has a file of your custom type, and if so set the attachment cell for that attachment. It would probably be easiest to do this at load time, before the document is ever displayed, although with a little extra work it could be done lazily.


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


References: 
 >How do I save and restore a custom NSTextAttachmentCell? (From: Michael <email@hidden>)
 >Re: How do I save and restore a custom NSTextAttachmentCell? (From: Douglas Davidson <email@hidden>)
 >Re: How do I save and restore a custom NSTextAttachmentCell? (From: Michael <email@hidden>)

  • Prev by Date: Multithreading question
  • Next by Date: Re: strange quirk of UndoManager on NSTextView?
  • Previous by thread: Re: How do I save and restore a custom NSTextAttachmentCell?
  • Next by thread: NSDrawer buttons still active when parent window has a sheet open
  • Index(es):
    • Date
    • Thread