1

I'm using an NSImageView that is setup as an image well so users can add their own images. An image can be added to the NSImageView with drag and drop or copying and pasting the actual image, but does not work properly if the image file is copied in Finder then pasted into the NSImageView. How do I get image files that have been copied from Finder to be pasted into the image view as the correct image instead of the default jpeg icon?

Here is the code I'm using the create the view:

let view = NSImageView()
view.isEditable = true
view.allowsCutCopyPaste = true

And here is what appears in the image view when a jpeg file is copied from Finder and pasted in the image view:

  • Search for [NSView] drag drop. – El Tomato Nov 29 '18 at 23:18
  • What is the question? – Willeke Nov 29 '18 at 23:48
  • @Willeke I've updated my question to say "How do I get image files that have been copied from Finder to be pasted into the image view as the correct image instead of the default jpeg icon?" –  Nov 30 '18 at 16:27
  • 1
    The Finder puts an image of the icon on the pasteboard and the image view reads the image. If you want to read the file you have to override `paste:`. – Willeke Nov 30 '18 at 23:03

0 Answers0