2013-11-26 24 views
1

我有一個帶有電子郵件分享按鈕的iOS應用程序。在這方面,我想在應用商店中加入我們應用的鏈接。但是,我想將它鏈接到電子郵件正文中的一些文本,而不是僅包含URL。這可能嗎?如果是這樣,怎麼樣?謝謝!從ios應用程序中將超鏈接添加到電子郵件預加載的文本中

+2

您可以使用此http://stackoverflow.com/questions/2058447/mfmailcomposeviewcontroller-how-do-i-embed-a-clickable-url-link-into -電子郵件 – the1pawan

回答

2

請嘗試以下代碼

- (void) sendEventInEmail 
    { 
     MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init]; 
     picker.mailComposeDelegate = self; 

     [picker setSubject:@"Email Subject"]; 

     // Fill out the email body text 
     NSString *iTunesLink = @"--------Link to iTune App link----"; 
     NSString *content = [eventDictionary objectForKey:@"Description"]; 
     NSString *imageURL = [eventDictionary objectForKey:@"Image URL"]; 
     NSString *findOutMoreURL = [eventDictionary objectForKey:@"Link"]; 

     NSString *emailBody = [NSString stringWithFormat:@"<br /> <a href = '%@'> <img src='%@' align=left style='margin:5px' /> </a> <b>%@</b> <br /><br />%@ <br /><br />Sent using <a href = '%@'>What's On Reading</a> for the iPhone.</p>", findOutMoreURL, imageURL, emailSubject, content, iTunesLink]; 

     [picker setMessageBody:emailBody isHTML:YES]; 

     [self presentModalViewController:picker animated:YES]; 

    [picker release]; 
     } 

    - (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error 
     { 
      // Notifies users about errors associated with the interface 
      switch (result) 
      { 
       case MFMailComposeResultCancelled: 
        break; 
       case MFMailComposeResultSaved: 
        break; 
       case MFMailComposeResultSent: 
        break; 
       case MFMailComposeResultFailed: 
        break; 
       default: 
        break; 
      } 
      [self dismissModalViewControllerAnimated:YES]; 
     } 
相關問題