Copying an image file to pasteboard
Copying an image file to pasteboard
- Subject: Copying an image file to pasteboard
- From: Jeremy Dronfield <email@hidden>
- Date: Mon, 2 Aug 2004 20:56:23 +0100
This question is so basic I can't even believe I'm having to ask it;
but I can't find anything in the docs or archives, so here goes.
In the Finder, select an image file and hit Command-C to copy it, then
open TextEdit and hit Command-V. The image is pasted in. Saving and
opening the RTFD package, you will find that the image attachment
inside has the title of the original image. Fine. So how was that image
written to the pasteboard by the Finder? I have an application in which
I want to be able to place images on the pasteboard for pasting into
other apps. However, the only way I can get a pastable image onto the
pasteboard is by doing [pboard set
Data:[image TIFFRepresentation]
forType:NSTIFFPboardType]. This is clearly not the same thing. I've
tried:
[pboard setPropertyList:[NSArray arrayWithObject:filePath]
forType:NSFilenamesPboardType]
and
[pboard writeFileContents:filePath]
and creating a file wrapper from the file and using,
[pboard writeFileWrapper:wrapper]
and various combinations of these. None of them work. Can someone
please tell me what I'm missing here?
Regards,
-Jeremy
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.