How can one copy images to the UIPasteboard?
I have only seen examples for text.
If you look at Apple's Documentation for UIPasteboard, you see that you can use the 'setImage:` method to copy images to the pasteboard, eg:
[[UIPasteboard generalPasteboard] setImage:myImage];
or if you want to add multiple images:
[[UIPasteboard generalPasteboard] setImages:[NSArray arrayWithObjects:myFirstImage, mySecondImage, nil]];
or if you already have the array of images:
[[UIPasteboard generalPasteboard] setImages:myImagesArray];
(where all the above variables that begin with my
should be substituted for the ones in your code)
use this ..... here newImage is UIImage.
UIPasteboard *pasteBoard = [UIPasteboard pasteboardWithName:UIPasteboardNameGeneral create:NO];
pasteBoard.persistent = YES;
NSData *data = UIImagePNGRepresentation(newImage);
[pasteBoard setData:data forPasteboardType:(NSString *)kUTTypePNG];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"sms:00"]];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With