本文介绍了在setMessageBody中忽略新行和返回的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我做的事情是愚蠢的吗?我可以预先填写并发送电子邮件,但在电子邮件中忽略\\\ n:

Am I doing something dumb? I can pre-fill and email ok but the "\r\n" is ignored in the emailBody:

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

    NSString *emailSubject = [eventDictionary objectForKey:EVENT_NAME_KEY];

    [picker setSubject:emailSubject];

    // Fill out the email body text
    NSString *iTunesLink = @"http://itunes.apple.com/gb/app/whats-on-reading/id347859140?mt=8"; // Link to iTune App link
    NSString *content = [eventDictionary objectForKey:@"Description"];
    NSString *emailBody = [NSString stringWithFormat:@"%@\r\nSent using <a href = '%@'>What's On Reading</a> for the iPhone.", content, iTunesLink];

    [picker setMessageBody:emailBody isHTML:YES];

    picker.navigationBar.barStyle = UIBarStyleBlack;

    [self presentModalViewController:picker animated:YES];
    [picker release];
}

问候

Dave

推荐答案

Doh ...一直在努力工作并将Objective C字符串与HTML混合。使用< p> < / p> 要修复的代码。

Doh... been working too hard and mixing Objective C strings with HTML. Used <p> and </p> tags to fix.

戴夫

这篇关于在setMessageBody中忽略新行和返回的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-22 19:20