• 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: Douglas Davidson <email@hidden>
  • Date: Fri, 14 Jan 2005 13:45:01 -0800


On Jan 14, 2005, at 1:27 PM, Gwynne 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.

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: NSTextAttachment behavior
      • From: Gwynne <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>)

  • Prev by Date: Re: NSTextAttachment behavior
  • Next by Date: Re: NSTextAttachment behavior
  • Previous by thread: Re: NSTextAttachment behavior
  • Next by thread: Re: NSTextAttachment behavior
  • Index(es):
    • Date
    • Thread