• 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: NSTextAttachment behavior
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTextAttachment behavior


  • Subject: Re: NSTextAttachment behavior
  • From: Gwynne <email@hidden>
  • Date: Fri, 14 Jan 2005 16:52:34 -0500

On Jan 14, 2005, at 4:45 PM, Douglas Davidson wrote:
My solution is this:

// Yes, I should get the image into a separate var and then set it.
NSTextAttachment *attachment = [[NSTextAttachment alloc] init];
[[a attachmentCell] setImage:[[NSWorkspace sharedWorkspace] iconForFile:path]];
[[[a attachmentCell] image] setSize:NSMakeSize( 16, 16 )]; // get the small icon
And what I'm recommending is more like this:

NSTextAttachment *attachment = [[NSTextAttachment alloc] init];
NSImage *icon = [[NSWorkspace sharedWorkspace] iconForFile:path];
NSTextAttachmentCell *attachmentCell;
[icon setSize:NSMakeSize(16, 16)];
attachmentCell = [[NSTextAttachmentCell alloc] initImageCell:icon];
[attachment setAttachmentCell:attachmentCell];
[attachmentCell release];

Your way works OK most of the time but possibly not every time. I currently maintain NSTextAttachment, and I'm not going to guarantee anything about the cell that it automatically creates.

That makes more sense, and eliminates gcc's complaints that -image and -setImage: aren't part of the protocol :). Thanks for the help; this was exactly what I needed.


-- Gwynne, key to the Code
Email: email@hidden
Website: http://musicimage.plasticchicken.com/
"This whole world is an asylum for the incurable."

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
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: 
 >NSTextAttachment behavior (From: Gwynne <email@hidden>)
 >Re: NSTextAttachment behavior (From: Frank Midgley <email@hidden>)
 >Re: NSTextAttachment behavior (From: Douglas Davidson <email@hidden>)
 >Re: NSTextAttachment behavior (From: Gwynne <email@hidden>)
 >Re: NSTextAttachment behavior (From: Douglas Davidson <email@hidden>)

  • Prev by Date: Re: NSTextAttachment behavior
  • Next by Date: Re: menuItem connection to other nib
  • Previous by thread: Re: NSTextAttachment behavior
  • Next by thread: Re: NSTextAttachment behavior
  • Index(es):
    • Date
    • Thread