【问题标题】:MFMailComposerViewController not recognizing URL as linkMFMailComposerViewController 未将 URL 识别为链接
【发布时间】:2012-05-18 21:50:42
【问题描述】:

MFMailComposerViewController 在其消息正文中将 URL 显示为纯文本,而不是可点击的链接。无论如何我可以做到这一点吗?

【问题讨论】:

  • 在你的问题中添加你的代码行

标签: iphone ios xcode cocoa-touch ios4


【解决方案1】:

使用– setMessageBody:isHTML: 设置为带有<a href="link">The link</a> 的HTML。平淡就是所谓的平淡。

【讨论】:

    【解决方案2】:
        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];
    

    希望这对你有用。快乐编码:)

    【讨论】:

      【解决方案3】:

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

      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.
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2023-03-25
        • 2013-12-09
        相关资源
        最近更新 更多