开发者

Want to copy a gif image from my app to the in-app mail window. How do i do that?

开发者 https://www.devze.com 2023-03-26 10:14 出处:网络
I am having some confusion here... how do i display gif for my iPhone app? (I mean there are various articles which i found, but every tutorial just didn\'t have a complete solution)

I am having some confusion here...

how do i display gif for my iPhone app? (I mean there are various articles which i found, but every tutorial just didn't have a complete solution)

There are many solutions between which i am confused.

Should i split gif into different frames using an online tool and then display it in UIImageView using animation?

Or should i display gif into a UIWebview?

Or should i use this article? http://blog.stijnspijker.nl/2009/07/animated-and-transparent-gifs-for-iphone-made-easy/

This article is pretty nice but it cuts the rest of the frames making the image 开发者_如何转开发smaller in size. Moreover, i am not able to know how its working so i dont know the reason of frames getting cut.

Please note that after i display the gif, i want to copy the gif and then paste it in my in-app mail window.

Need help plz. Thanks!


UIWebView is a the biggest memory-hog in UIKit and should be avoided whenever possible. Converting gif to series of png files and displaying it using UIImageView with animated image sequence is best you can do.

But to use it in the mail window, you would have to keep the gif too. Now how you want to insert it depends on if you want it to be an attachment or a html img. I would suggest the second option, and hosting the gif somewhere online, then doing:

[mailController setMessageBody:@"<img src=\"http://path.to/image.gif\" />" isHTML:YES];

And if you want to add it as attachment:

NSData *imageData = [[NSData alloc] initWithContentsOfFile:pathToGifFile];
[mailController addAttachmentData:imageData mimeType:@"image/gif" fileName:@"pic.gif"];
[imageData release];
0

精彩评论

暂无评论...
验证码 换一张
取 消