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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to