NSTextView 判断 NSTextAttachment 是否存在

发布于 2024-08-21 20:07:34 字数 104 浏览 3 评论 0原文

在我的 MyDocument 类中,我需要确定 NSTextView 中是否有图像,因此我可以阻止用户将文档保存为 RTF,尽管 RTF 不支持图像。

有人能指出我正确的方向吗?

in my MyDocument class I need to determine if there is an image in my NSTextView, so I can prevent users from saving documents as RTF although RTF doesn't support images.

Could someone point me in the right direction?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

小鸟爱天空丶 2024-08-28 20:07:34

是否有原因无法像 TextEdit 那样支持带有图像的文档的 RTFD?

如果这确实不是一个选项,请询问您的属性字符串是否包含附件。这就是嵌入图像:附件。

另外,您不应该将视图用作存储类。文档本身应该拥有文本并将其公开在属性中,并且您应该将文本视图的值绑定到该属性。

Is there a reason you can't support RTFD for documents with images, like TextEdit does?

If that really isn't an option, ask your attributed string whether it contains attachments. That's what embedded images are: attachments.

Also, you shouldn't use your views as storage classes. The document itself should own the text and expose it in a property, and you should bind the text view's value to that property.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文