当我在NSTextAttachment中拖动图像时,它是一个.rtf

时间:2018-04-25 02:16:50

标签: objective-c cocoa nstextfield nstextattachment

我有NSTextView显示这样的图像。

NSTextAttachment *attachment = [[NSTextAttachment alloc] init];
NSImage *attachImage = [NSImage imageNamed:@"Settings"];
attachment.image = attachImage;
NSAttributedString *attributedString = [NSAttributedString  attributedStringWithAttachment: attachment];
[[self.textView textStorage] appendAttributedString:attributedString];

图像显示正确,但我无法将图像从文本字段拖到桌面上。每次我尝试我最终得到.rtf文件而不是图像。无论如何围绕这个问题?

0 个答案:

没有答案