• 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: NSImage in NSAttributedString
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >NSImage in NSAttributedString (From: Timothy Larkin <email@hidden>)

  • Prev by Date: Re: Weird bug in IB...
  • Next by Date: Token in NSAttributedString | was: NSImage in NSAttributedString
  • Previous by thread: Token in NSAttributedString | was: NSImage in NSAttributedString
  • Next by thread: Core Data + Unidirectional Relationships
  • Index(es):
    • Date
    • Thread