我想展示一个gif,所以我做的就是拆分我的gif,并使用这个链接在UIImageView的动画中展示它。
http://iphonenativeapp.blogspot.com/2011/03/how-to-show-animation-in-iphoneipad-app.html
现在,我想让用户复制该gif并将其粘贴到邮件应用程序中。
如果我使用包含所有gif拆分图像的数组,那么4-5个图像将被粘贴到邮件应用程序中。
请帮我粘贴gif。谢谢!
发布于 2011-08-08 23:24:03
从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];编辑刚刚注意到你自己问了这两个类似的问题。
发布于 2011-08-08 22:22:33
尽管您可以使用基于HTML的电子邮件--例如:
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>标记中有时会起作用--这取决于用于呈现图像数据的电子邮件客户端和浏览器--但它不能广泛移植。
发布于 2013-03-22 02:28:02
在iOS 6的新共享表中,动画gif似乎与电子邮件一起工作,如果用户选择邮件,它将自动填充电子邮件中的gif:
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];https://stackoverflow.com/questions/6982492
复制相似问题