在NSTextView混合图形? [英] Mixing graphics in NSTextView?

查看:255
本文介绍了在NSTextView混合图形?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我以为我在某处读到有一种方法可以在文本视图中嵌入图形或其他非文本,但我在苹果文档中找不到任何东西。任何人都可以指向正确的方向?我试图构建一个编辑器,而不只是一个视图。我想象在底层文本中的特殊字符,并基于文本属性,它将在文本布局中保留一些空白。 ?或者也许我需要自己布局块,使用NSTextContainers和自定义NSView流动图形周围的文本?

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?

推荐答案

查看NSTextAttachment和NSTextAttachmentCell。您可以在子类化NSTextAttachmentCell时自己绘制自定义图形。

Take a look into the NSTextAttachment and NSTextAttachmentCell. You can do your own custom drawing when you subclass the NSTextAttachmentCell.

Apple文档:文本附件编程主题

这篇关于在NSTextView混合图形?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆