gpt4 book ai didi

iphone - setMessageBody 中忽略新行和返回

转载 作者:行者123 更新时间:2023-12-03 18:26:36 24 4
gpt4 key购买 nike

我是不是在做一些蠢事?我可以预填写并发送电子邮件,但“\r\n”在 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];
}

问候

戴夫

最佳答案

如果 isHTML 设置 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]; 

如果 isHTML:NO 则输入\n

[picker setMessageBody:@"1st line\n2nd line\n3rd line\nand so on..." isHTML:NO]; 

它会给你这个:

第一行
第二行
第三行
依此类推...

关于iphone - setMessageBody 中忽略新行和返回,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2554250/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com