gpt4 book ai didi

iphone - 不显示 UITextField 内容的 MessageUI 框架问题

转载 作者:行者123 更新时间:2023-11-28 20:33:28 25 4
gpt4 key购买 nike

我在我的应用程序中包含了用于发送邮件的 messageUI 框架。它包含五个 UITextField,其中用户输入的值应显示在邮件正文中。这是我的代码

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

我面临的问题是所有四个文本字段值都显示,只有第五个文本字段值没有显示。任何想法?...我遗漏了什么吗?...

最佳答案

您在字符串形式中只有四个 %@,因此提供给格式方法的最后一个参数将被忽略。

将格式字符串更改为具有五个参数:

NSString *emailBody =[NSString stringWithFormat:@"Name :%@\nDate: %@\nPreferred Time Slot: %@\nE-Mail:%@\nSpecific Requests:%2",text1.text,text2.text,text3.text,text4.text,text5.text]; 

关于iphone - 不显示 UITextField 内容的 MessageUI 框架问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11429852/

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