• 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: Getting an NSImage from an NSTextView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting an NSImage from an NSTextView


  • Subject: Re: Getting an NSImage from an NSTextView
  • From: Douglas Davidson <email@hidden>
  • Date: Fri, 24 Jun 2005 09:14:51 -0700


On Jun 22, 2005, at 3:11 PM, Ian was here wrote:

I'm trying to get a reference to an NSImage that

already exists within an NSTextView. I've been through

the documentation, and am not quite clear on it. I

would appreciate any ideas.



Attachments are stored in the text as follows:  there is an NSAttachmentCharacter (the Unicode substitution character), with the NSAttachmentAttributeName attribute, the value of which is an NSTextAttachment.  The NSTextAttachment has an NSFileWrapper, which stores the contents of the attached file, and an NSTextAttachmentCell, which draws an appropriate representation inline in the text.  

By default the text system will create an appropriate cell based on its notion of the contents of the attached file, typically displaying either the contents of the file as an image, or an icon for the file type, although there are other possibilities.  If the cell in fact is displaying an image, then you can obtain it by asking the NSTextAttachment for its attachmentCell, and the cell for its image.  

The default behavior can, of course, be altered or overridden; it is possible to supply a custom attachment cell, which can do more or less arbitrary drawing to represent the attachment.  However, it seems from your question that you are dealing with the default behavior and with an attached file that actually is an image and so would be represented by an image cell.

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: 
 >Getting an NSImage from an NSTextView (From: Ian was here <email@hidden>)

  • Prev by Date: Re: Core Data Multiple User question
  • Next by Date: Re: DragNDropOutlineView Example Define Syntax
  • Previous by thread: Getting an NSImage from an NSTextView
  • Next by thread: NSConnection not working between processes
  • Index(es):
    • Date
    • Thread