Mixing graphics in NSTextView?
-
25-09-2019 - |
Question
I thought I read somewhere that there is a way to embed drawings or other non-text in a text view, but I can't find anything about it in the Apple documentation. Can anyone point me in the right direction? I'm trying to build an editor, not just a view. I'm imagining a special character in the underlying text, and based on text attributes, it would reserves some blank space in the text layout. ? Or maybe I need to layout blocks myself, using NSTextContainers and a custom NSView to flow text around graphics?
Solution
Take a look into the NSTextAttachment and NSTextAttachmentCell. You can do your own custom drawing when you subclass the NSTextAttachmentCell.
Apple docs: Text Attachment Programming Topics
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow