我想将“发送自”文本添加到邮件的底部
if([MFMailComposeViewController canSendMail]){
MFMailComposeViewController *controller = [[MFMailComposeViewController alloc] init];
controller.mailComposeDelegate = self;
[controller setSubject:[NSString stringWithFormat:@"A message from: %@",self.profileName]];
[controller setMessageBody:[NSString stringWithFormat:@"%@",self.cellBody] isHTML:NO];
[self presentModalViewController:controller animated:YES];
[controller release];
}
else {
UIAlertView *alertView;
alertView = [[UIAlertView alloc] initWithTitle:@"E-Mail Not Enabled" message:@"E-Mail is not supported on this device" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alertView show];
[alertView release];
}
答案 0 :(得分:2)
您可以将邮件正文设置为isHTML:YES
并使用换行符<br>
或尝试使用\n
字符串中的setMessageBody
然后在此之后添加“发送自”信息。
答案 1 :(得分:0)
试试这段代码我已根据您的要求更改了代码
if([MFMailComposeViewController canSendMail]){
MFMailComposeViewController *controller = [[MFMailComposeViewController alloc] init];
controller.mailComposeDelegate = self;
[controller setSubject:[NSString stringWithFormat:@"A message from: %@",self.profileName]];
[controller setMessageBody:[NSString stringWithFormat:@"%@\nSent from : %@",self.cellBody,self.profileName] isHTML:NO];
[self presentModalViewController:controller animated:YES];
[controller release];
}
else {
UIAlertView *alertView;
alertView = [[UIAlertView alloc] initWithTitle:@"E-Mail Not Enabled" message:@"E-Mail is not supported on this device" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alertView show];
[alertView release];
}
快乐编码......