I am trying to save an image from a URL to the clipboard. I tried using:
NSURL *url = [NSURL URLWithString:fromURL];
NSData *imageData = [[NSData alloc] initWithContentsOfURL:url];
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
[pasteboard setData:imageData forPasteboardType:@"kUTTypeJPEG"]; //is kUTTypeJPEG even the right type?
but it does not work. It does not give a warning, error or anything.
Try this,
For saving image to clipboard :
[UIPasteboard generalPasteboard].image = someImage;
To get the image out again from clipboard :
UIImage *someImage = [UIPasteboard generalPasteboard].image;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.