【问题标题】:Email Signature App Iphone电子邮件签名应用程序 Iphone
【发布时间】:2012-11-26 09:37:07
【问题描述】:

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

【问题讨论】:

  • 抱歉,这听起来像是“我有一个应用程序的想法,但不知道怎么做。你能写代码并发给我吗?”。不要期望对此类问题有任何有用的答案。尝试一些事情,用你的头脑,随时再问......
  • @LionKing 只需从一个视图使用此波纹管方法在 MailComposeViewController 中发送带有消息和图像的电子邮件,您可以看到消息和图像,因此这里不需要另一个视图来发送电子邮件.. 请参阅下面的答案..

标签: iphone objective-c xcode


【解决方案1】:

我有这种发送带有图像和消息的电子邮件的方法.. 只需在 .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];
}

希望对你有帮助……

【讨论】:

    猜你喜欢
    • 2010-12-02
    • 2011-05-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-06-19
    • 2018-07-24
    • 2012-07-30
    相关资源
    最近更新 更多