【问题标题】:Add hyperlink into preloaded text in email from ios app将超链接添加到来自 ios 应用程序的电子邮件中的预加载文本
【发布时间】:2013-12-11 01:27:39
【问题描述】:

我有一个带有电子邮件共享按钮的 iOS 应用。在那,我想在应用商店中包含指向我们应用的链接。但是,我想将其超链接到电子邮件正文中的某些文本,而不是仅包含 URL。这可能吗?如果是这样,怎么做?谢谢!

【问题讨论】:

标签: ios objective-c email hyperlink


【解决方案1】:

请尝试以下代码

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

【讨论】:

    猜你喜欢
    • 2013-08-22
    • 2015-01-10
    • 1970-01-01
    • 2012-10-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多