2012-11-26 31 views
-4

我正在製作一個電子郵件簽名應用程序,允許用戶簽名並使用它們發送電子郵件,它們是簽名名稱(文本字段),內容(文本視圖)和圖像(圖像視圖),而我我將它們保存在數據庫中,以便如果用戶從第二個視圖中的表視圖中選擇了簽名名稱,預覽將顯示在相同的視圖上,就像我從表視圖中選擇簽名1然後在預覽部分中籤名圖像應該(文本視圖)中顯示簽名內容,然後在相同的視圖上按下發送(按鈕)從預覽部分的文本視圖中的文本和圖像將被複制到剪貼板,然後在第三個視圖中,我可以將其粘貼到消息部分和發送電子郵件,是否有可能做到這一點,如果是的話我怎麼能實現它或任何其他想法如何做到這一點?電子郵件簽名應用程序Iphone

+1

很抱歉,但聽起來像「我有一個應用程序的想法,但不知道如何做到這一點。的Coul你寫代碼併發送給我?「。不要指望這個問題有任何有用的答案。嘗試一下,用你的腦袋,隨時再問... – tamasgal

+0

@LionKing只需從一個視圖使用此波紋管方法發送帶有MailComposeViewController中的消息和圖像的電子郵件,您可以看到消息和圖像,因此這裏不需要另一個視圖發送電子郵件..看到我的答案咆哮.. –

回答

0

我有一個與圖像和消息發送電子郵件這個方法..只是在.h文件中添加MFMessageComposeViewControllerDelegate和項目

-(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]; 
    } 

} 

添加框架MessageUI.framework這種波紋管的方法是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]; 
} 

我希望這會幫助你...