Re: [Newbie] Displaying an NSImage inside an NSTextField?
Re: [Newbie] Displaying an NSImage inside an NSTextField?
- Subject: Re: [Newbie] Displaying an NSImage inside an NSTextField?
- From: Kirk Kerekes <email@hidden>
- Date: Tue, 30 Jun 2009 12:05:45 -0500
An alternative to the other ideas presented previously:
Read up on NSAttributedString. Use NSTextAttachment to attach your
image to an NSAttributedString, and then use -setAttributedStringValue
to set the string in your NSTextField.
This has worked nicely for me with the cells in NSTableView -- I don't
see why it wouldn't work in an NSTextField.
This approach will let you embed your image as an in-line image that
is locked to a character position in the text.
And you can build test strings in TextEdit, use
initWithRTFD:documentAttributes: to import them into NSAttributedString.
_______________________________________________
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