MFMailComposerViewController无法将URL识别为链接

时间:2012-05-10 10:23:06

标签: iphone ios xcode cocoa-touch ios4

MFMailComposerViewController在其邮件正文中以纯文本形式显示URL,而不是可点击链接。无论如何我能做到这一点吗?

3 个答案:

答案 0 :(得分:2)

使用– setMessageBody:isHTML:设置为<a href="link">The link</a>的HTML。平原就像它所说的那样平原。

答案 1 :(得分:1)

    MFMailComposeViewController *composer = [[MFMailComposeViewController alloc] init];
    composer.mailComposeDelegate = self;

    [composer setMessageBody:message isHTML:YES];
    NSMutableString *body = [NSMutableString string];
    [body appendString:@"<h1>Hello User!</h1>\n"];
    [body appendString:@"<a href=\"http://www.mysite.com/path/to/link\">Click Me!</a>\n"];
    [composer setMessageBody:body isHTML:YES];
希望这对你有用。快乐的编码:)

答案 2 :(得分:1)

是的,这是可能的,你可以这样做:

MFMailComposeViewController *composer = [[MFMailComposeViewController alloc] init]; composer.mailComposeDelegate = self; 
[composer setSubject:subject]; 
[composer setMessageBody:message isHTML:YES]; 
//Message is just a NSString with HTML Content and you can have all the HTML Contents in it.