-4

我正在制作一个电子邮件签名应用程序,允许用户进行签名并使用它们与电子邮件一起发送,它们是签名名称(文本字段)、内容(文本视图)和图像(图像视图),我将它们保存在数据库中,以便如果用户从第二个视图上的表视图中选择签名名称,则预览将显示在同一视图上,就像我从表视图中选择签名 1 一样,则在预览部分中,签名图像应与签名内容一起显示在(文本视图),然后在同一个视图中,我们按下发送(按钮),预览部分的文本视图中的文本和图像将被复制到剪贴板,然后在第三个视图中,我可以将其粘贴到消息部分并发送电子邮件,是否有可能这样做,如果是的话,我该如何实现它或任何其他想法如何做到这一点?

4

1 回答 1

0

我有这种发送带有图像和消息的电子邮件的方法..只需添加.h文件并在您的项目中MFMessageComposeViewControllerDelegate添加框架MessageUI.framework

-(void)sendMailWithImage:(NSString *)message Image:(UIImage *)image{
    if ([MFMailComposeViewController canSendMail]) 
    {
        UIImage *tempImageSave=image;
        MFMailComposeViewController *mailComposeViewController = [[MFMailComposeViewController alloc] init];
        NSString *mailBody = message;

        NSData *imageData = UIImagePNGRepresentation(tempImageSave);
        [mailComposeViewController addAttachmentData:imageData mimeType:@"image/png" fileName:@"Testing"];
        [mailComposeViewController setMessageBody:mailBody isHTML:NO];
        mailComposeViewController.mailComposeDelegate = self;
        [self presentViewController:mailComposeViewController animated:YES completion:nil];
    } 
    else 
    {
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"e-Mail Sending Alert"
                                                        message:@"You can't send a mail"
                                                       delegate:nil
                                              cancelButtonTitle:@"OK" 
                                              otherButtonTitles:nil];
        [alert show];
        [alert release];
    }

}

这个波纹管方法是委托方法MFMessageComposeViewControllerDelegate

#pragma mark - MFMessage Delegate

- (void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result
{
    [self dismissViewControllerAnimated:YES completion:nil];
}

- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error
{
    if (result == MFMailComposeResultSent) 
    {
        NSLog(@"\n\n Email Sent");
    }
    [self dismissViewControllerAnimated:YES completion:nil];
}

我希望这可以帮助你...

于 2012-11-26T09:46:06.403 回答