• 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 to get NSImage into an NSMutableAttributedString ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to get NSImage into an NSMutableAttributedString ?


  • Subject: Re: How to get NSImage into an NSMutableAttributedString ?
  • From: Douglas Davidson <email@hidden>
  • Date: Mon, 1 Dec 2003 14:04:46 -0800

On Dec 1, 2003, at 12:54 PM, Bob Miller wrote:

This may be a simple operation but, I've yet to figure it out and haven't been able to find an answer for this one anywhere .I hope someone can help. Does anyone know if it is possible to insert an NSImage reference into an NSAttributedStrin so that it becomes 'attached' and gets displayed within the string similar as it would if an image file was dragged from the desktop for instance ? Is it even possible to insert and NSImage into an NSAttributedString (Mutable that is) ?

Yes, certainly. Attachments appear in text as an NSAttachmentCharacter with an NSAttachmentAttributeName attribute, whose value is an NSTextAttachment. The content of the NSTextAttachment is handled by an NSFileWrapper, which is used when saving the text, copying/pasting, and so forth. The rendering of the NSTextAttachment is handled by an NSTextAttachmentCell. If you are only interested in display, then you can supply a cell for your text attachment and set its image to your image of choice. If you are interested in having it save properly, then you can supply file data for the NSFileWrapper; by default the text system will create an appropriate cell, according to its own notions, or you can supply one if you wish.

Douglas Davidson
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >How to get NSImage into an NSMutableAttributedString ? (From: Bob Miller <email@hidden>)

  • Prev by Date: Re: Drawing complex vector shapes
  • Next by Date: Re: Source code documentation systems for Cocoa
  • Previous by thread: How to get NSImage into an NSMutableAttributedString ?
  • Next by thread: Re: How to get NSImage into an NSMutableAttributedString ?
  • Index(es):
    • Date
    • Thread