I want to copy .gif images to clipboard, so as user can paste that gif images from application to mails, etc...
I have tried :-
NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://fc05.deviantart.net/fs37/f/2008/283/a/b/KaleidoCoils_animated__gif_by_1389AD.gif"]];
UIPasteboard *pasteBoard=[UIPasteboard generalPasteboard];
[pasteBoard setImage:[UIImage imageWithData:data]];
but it copies in format of .png and not .gif. How can I copy .gif image with its animation to clipboard which can be used as paste option in other application?
Application https://itunes.apple.com/us/app/animated-3d-emoji+emoticons/id429348043?mt=8 already does this.
Please help me.
Thanks in advance
I found solution for same :-
This is my code which helped me:-
@import MobileCoreServices;
NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://fc05.deviantart.net/fs37/f/2008/283/a/b/KaleidoCoils_animated__gif_by_1389AD.gif"]];
UIPasteboard *pasteBoard=[UIPasteboard generalPasteboard];
[pasteBoard setData:data forPasteboardType:(__bridge NSString *)kUTTypeGIF];
@"com.compuserve.gif"
comes from http://www.escape.gr/manuals/qdrop/UTI.html
Hope this helps someone... :)
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