Mag*_*ave 12 iphone mfmailcomposeviewcontroller
我在做一些蠢事吗?我可以预先填写并发送电子邮件,但在电子邮件中忽略"\ 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];
}
Run Code Online (Sandbox Code Playgroud)
问候
戴夫
Tib*_*abo 28
如果isHTML设置YES \n不起作用,您必须设置isHTML:NO或使用HTML换行符(例如<br />输入新行).
<p> </p>插入一个新段落,通常意味着双行中断.
尝试使用isHTML:是:
[picker setMessageBody:@"1st line<br />2nd line<br />3rd line<br />and so on..." isHTML:YES];
Run Code Online (Sandbox Code Playgroud)
如果isHTML:NO只是放\n
[picker setMessageBody:@"1st line\n2nd line\n3rd line\nand so on..." isHTML:NO];
Run Code Online (Sandbox Code Playgroud)
它会给你这个:
第1行
第2行
第3行
等等......
Doh...一直在努力将 Objective C 字符串与 HTML 混合在一起。使用<p>和</p>标签来修复。
戴夫
| 归档时间: |
|
| 查看次数: |
5967 次 |
| 最近记录: |