首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >不显示UITextField内容的MessageUI框架问题

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

Stack Overflow用户
提问于 2012-07-11 17:44:05
回答 2查看 120关注 0票数 0

我已经在我的应用程序中包含了messageUI框架,用于发送包含五个UITextField的mail.It,其中用户输入的值应该显示在邮件正文中。以下是我的代码

代码语言:javascript
复制
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?...

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2012-07-11 17:49:50

编辑以下代码行

代码语言:javascript
复制
 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隐藏键盘...

票数 1
EN

Stack Overflow用户

发布于 2012-07-11 17:45:32

表单at string中只有四个%@,因此提供给format方法的最后一个参数将被忽略。

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

代码语言:javascript
复制
NSString *emailBody =[NSString stringWithFormat:@"Name :%@\nDate: %@\nPreferred Time Slot: %@\nE-Mail:%@\nSpecific Requests:%2",text1.text,text2.text,text3.text,text4.text,text5.text]; 
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/11429852

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档