我已经在我的应用程序中包含了messageUI框架,用于发送包含五个UITextField的mail.It,其中用户输入的值应该显示在邮件正文中。以下是我的代码
if ([MFMailComposeViewController canSendMail])
{
MFMailComposeViewController *mailer = [[MFMailComposeViewController alloc] init];
mailer.mailComposeDelegate = self;
[mailer setSubject:[NSString stringWithFormat:@"Appointment From Mr/Mrs. %@",text1.text]];
NSArray *toRecipients = [NSArray arrayWithObjects:@"info@xxx.com", nil];
[mailer setToRecipients:toRecipients];
NSString *emailBody =[NSString stringWithFormat:@"Name :%@\nDate: %@\nPreferred Time Slot: %@\nE-Mail:%@\nSpecific Requests:",text1.text,text2.text,text3.text,text4.text,text5.text];
[mailer setMessageBody:emailBody isHTML:NO];
[self presentModalViewController:mailer animated:YES];
[mailer release];
}我面临的问题是,所有四个文本字段值都显示出来,只有第五个文本字段值不是displayed..Any idea?...am I displayed..Any idea?...am?...
发布于 2012-07-11 17:49:50
编辑以下代码行
NSString *emailBody =[NSString stringWithFormat:@"Name :%@\nDate: %@\nPreferred Time Slot: %@\nE-Mail:%@\nSpecific Requests:%@",text1.text,text2.text,text3.text,text4.text,text5.text]; 在你输入文本后,你的requirements...Dont会忘记使用resignFirstresponder隐藏键盘...
发布于 2012-07-11 17:45:32
表单at string中只有四个%@,因此提供给format方法的最后一个参数将被忽略。
将格式字符串更改为具有五个参数:
NSString *emailBody =[NSString stringWithFormat:@"Name :%@\nDate: %@\nPreferred Time Slot: %@\nE-Mail:%@\nSpecific Requests:%2",text1.text,text2.text,text3.text,text4.text,text5.text]; https://stackoverflow.com/questions/11429852
复制相似问题