我在做蠢事吗?我可以预先填写并通过电子邮件发送ok,但在emailBody中将忽略“\r\n”:

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

问候

戴夫

最佳答案

如果isHTML set YES\n不起作用,则必须设置isHTML:NO或使用HTML换行符,例如 <br /> 来输入新行

<p> </p> 插入一个新的段落,通常表示双行换行。

尝试使用isHTML:YES:

[picker setMessageBody:@"1st line<br />2nd line<br />3rd line<br />and so on..." isHTML:YES];

如果是HTML:否,只需输入\n
[picker setMessageBody:@"1st line\n2nd line\n3rd line\nand so on..." isHTML:NO];

它会给你这个:

第一条线第二条线第三条线,依此类推...

09-08 12:10