Re: NSTextAttachment behavior
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