pradeepa pradeepa - 10 months ago 53
iOS Question

How to copy UIImage data to clipboard/UIPasteboard? And how do I test it?

I tried to use the following code to copy the Image data to

on click of the Copy item in the menu.

UIPasteboard *gpBoard = [UIPasteboard generalPasteboard];
[[gpBoard setData:UIImageJPEGRepresentation(imgView.image, 1.0) forPasteboardType:UIPasteboardTypeListImage];

Which parameter i have to send for
:, and how to test after copying the data?

omz omz

It's a lot easier:

[UIPasteboard generalPasteboard].image = imgView.image;

To get the image out again:

UIImage *image = [UIPasteboard generalPasteboard].image;