想要将我的应用程序中的gif图像复制到应用程序内邮件窗口。我怎么做? [英] Want to copy a gif image from my app to the in-app mail window. How do i do that?

查看:104
本文介绍了想要将我的应用程序中的gif图像复制到应用程序内邮件窗口。我怎么做?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这里有些困惑...

I am having some confusion here...

我如何为我的iPhone应用程序显示gif?
(我的意思是我找到了各种文章,但每个教程都没有完整的解决方案)

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.

我应该使用在线工具将gif分割成不同的帧,然后使用动画在UIImageView中显示它吗?

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

或者我应该将gif显示在UIWebview中吗?

Or should i display gif into a UIWebview?

或者我应该使用这篇文章吗?
http:// blog.stijnspijker.nl/2009/07/animated-and-transparent-gifs-for-iphone-made-easy/

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.

请注意,在我显示gif之后,我想复制gif然后将其粘贴到我的应用程序内邮件窗口。

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

需要帮助PLZ。谢谢!

Need help plz. Thanks!

推荐答案

UIWebView是UIKit中最大的内存耗尽,应该尽可能避免。将gif转换为一系列png文件,并使用带有动画图像序列的UIImageView显示它是最好的。

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.

但是要在邮件窗口中使用它,你必须保持GIF也是如此。现在你想如何插入它取决于你是否想要它是一个附件或HTML img。我会建议第二个选项,然后在网上托管gif,然后执行:

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];

这篇关于想要将我的应用程序中的gif图像复制到应用程序内邮件窗口。我怎么做?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆