首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >我想粘贴gif到邮件窗口使用UIPasteBoard

我想粘贴gif到邮件窗口使用UIPasteBoard
EN

Stack Overflow用户
提问于 2011-08-08 20:55:45
回答 4查看 2.2K关注 0票数 3

我想展示一个gif,所以我做的就是拆分我的gif,并使用这个链接在UIImageView的动画中展示它。

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

现在,我想让用户复制该gif并将其粘贴到邮件应用程序中。

如果我使用包含所有gif拆分图像的数组,那么4-5个图像将被粘贴到邮件应用程序中。

请帮我粘贴gif。谢谢!

EN

回答 4

Stack Overflow用户

回答已采纳

发布于 2011-08-08 23:24:03

similar question复制/粘贴我自己的答案。

代码语言:javascript
复制
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];

编辑刚刚注意到你自己问了这两个类似的问题。

票数 7
EN

Stack Overflow用户

发布于 2011-08-08 22:22:33

尽管您可以使用基于HTML的电子邮件--例如:

代码语言:javascript
复制
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
NSString *emailBody = @"<p><b>Hello World</b></p>";                         
[picker setMessageBody:emailBody isHTML:YES];

您不能像在HTML中那样插入内联图像。HTML电子邮件中的内联图像使用单独的MIME部分,这些部分通过content-id元素从邮件正文中引用。MFMailComposeViewController不允许您控制消息的MIME结构,因此不允许您添加内联引用的内容部分。

像base64一样将图像数据嵌入到<img>标记中有时会起作用--这取决于用于呈现图像数据的电子邮件客户端和浏览器--但它不能广泛移植。

票数 0
EN

Stack Overflow用户

发布于 2013-03-22 02:28:02

在iOS 6的新共享表中,动画gif似乎与电子邮件一起工作,如果用户选择邮件,它将自动填充电子邮件中的gif:

代码语言:javascript
复制
NSString *gifPath = [[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@"volleyball.gif"];
NSData *gifData = [[NSData alloc] initWithContentsOfFile:gifPath];
NSArray *activityItems = [NSArray arrayWithObjects:@"Here is an awesome body for the email.",gifData,nil];
UIActivityViewController *activityController = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:nil];
activityController.completionHandler = ^(NSString *activityType, BOOL completed){
  // item was shared!
  // you can check if it was email (or another type, like facebook or twitter) in the *activityType.
  // completed is YES if they actually shared it, if they canceled, completed will be NO.
};
[navigationController presentViewController:activityController animated:YES completion:nil];
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/6982492

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档