Re: NSImage in NSAttributedString
Re: NSImage in NSAttributedString
- Subject: Re: NSImage in NSAttributedString
- From: Alexander Spohr <email@hidden>
- Date: Wed, 12 Nov 2008 17:15:30 +0100
Timothy,
how about a nice category?
atze
Am 12.11.2008 um 12:34 schrieb Timothy Larkin:
I am building an attributed string for display in a NSTextView. I
can include an image in the string by attaching a file wrapper. But
what if I have just an NSImage? I know that an image from the
clipboard can be inserted in a text view. But how can I do this
programatically? Is there a better way than writing the image to a
temporary file and then using that file wrapper?
@implementation NSTextAttachment (Freeport)
- (id)initWithImage:(NSImage *)anImage
{
if([super init])
{
NSTextAttachmentCell *anAttachmentCell = [[NSTextAttachmentCell
alloc] initImageCell:anImage];
[self setAttachmentCell:anAttachmentCell];
[anAttachmentCell release];
return self;
}
return nil;
}
@end
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden