Search code examples
iosgifuipasteboard

Want to paste gif into mail window using UIPasteBoard


I wanted to show a gif so what i did was that i split my gif and showed it in a animation for UIImageView using this link.

http://iphonenativeapp.blogspot.com/2011/03/how-to-show-animation-in-iphoneipad-app.html

Now, i want to make the user copy that gif and paste it in the mail app.

If i used the array which contained all the split images of gif then 4-5 images get pasted in the mail app.

Please help me paste the gif. Thanks!


Solution

  • Gonna copy/paste my own answer from a similar question.

    NSString *gifPath = [[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@"volleyball.gif"];
    NSData *gifData = [[NSData alloc] initWithContentsOfFile:gifPath];
    UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
    [pasteboard setData:gifData forPasteboardType:@"com.compuserve.gif"];
    [gifData release];
    

    Edit just noticed you asked these 2 similar questions yourself.