像附加到uiactivityviewcontroller消息io

像附加到uiactivityviewcontroller消息io

本文介绍了我如何将图像附加到uiactivityviewcontroller消息ios?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将图像附加到UIActivityViewController消息类型。如果以编程方式无法实现,请告诉我如何将图像复制并粘贴到粘贴板。这是我的代码。

How can attach an image to UIActivityViewController message type. If it is not possible by programatically, then tell me how to copy and paste image to pasteboard. here is my code.

UIImage *image = photoView.image;
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
pasteboard.persistent = YES;
pasteboard.image = photoView.image;

NSString *firstN = [NSString stringWithFormat:@"First Name    : %@",((data.firstName)?data.firstName:@"")];
NSString *lastN = [NSString stringWithFormat:@"Last Name    : %@",((data.lastName)?data.lastName:@"")];
NSString *phoneMob = [NSString stringWithFormat:@"Mobile           : %@",((data.phoneMob)?data.phoneMob:@"")];
NSString *phoneHome = [NSString stringWithFormat:@"Home            : %@",((data.phoneHome)?data.phoneHome:@"")];
NSString *emailOff = [NSString stringWithFormat:@"Email(Off.)     : %@",((data.emailOffice)?data.emailOffice:@"")];
NSString *emailPers = [NSString stringWithFormat:@"Email(Pers.)  : %@",((data.emailPersonal)?data.emailPersonal:@"")];

NSArray *actItems = [NSArray arrayWithObjects:image,pasteboard,firstN,lastN,phoneMob,phoneHome,emailOff,emailPers, nil];

UIActivityViewController *actCtrl = [[UIActivityViewController alloc]initWithActivityItems:actItems applicationActivities:nil];

actCtrl.excludedActivityTypes = @[UIActivityTypePrint,UIActivityTypeCopyToPasteboard, UIActivityTypeAssignToContact,UIActivityTypeSaveToCameraRoll];

[self presentViewController:actCtrl animated:YES completion:nil ];

在上面的代码中,我无法将图像粘贴到邮件正文

In the above code, i couldn't paste the image to the message body

推荐答案

您无法直接上传图像。您必须将图像转换为数据并上传数据。

You can't able to directly upload the image. You have to convert image to data and upload the data.

这篇关于我如何将图像附加到uiactivityviewcontroller消息ios?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-27 04:56