NSTextView 判断 NSTextAttachment 是否存在
在我的 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是否有原因无法像 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.