2012-07-11 4 views
0

메일 응용 프로그램에 messageUI 프레임 워크를 포함 시켰습니다. 사용자가 입력 한 값을 메일 본문에 표시해야하는 5 개의 UITextField가 있습니다. 여기에 ...? 내가 직면하고있어 문제는 모두 네 개의 텍스트 필드 값은 다섯 번째 텍스트 필드의 값이 displayed..Any 생각하지 표시됩니다 것입니다UITextField 내용에 대한 MessageUI 프레임 워크 문제가 표시되지 않습니다.

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:@"[email protected]", 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]; 
} 

내 코드는 내가 무엇을 놓치고? ..

답변

1

편집 다음 코드 줄을

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

당신이 망가 후 키보드를 숨길 resignFirstresponder를 사용하는 것을 잊지 ... 당신의 요구 사항을 얻을 것이다 u는 텍스트를 입력 ...

+0

답변 및 추가 정보 주셔서 감사합니다. 나는 다른 질문에 그 질문을 생각 ... – Dany

2

문자열에 양식에 %@이 네 개만 있으므로 형식 메서드에 제공된 마지막 매개 변수가 무시됩니다. 5 개 개의 매개 변수를 가지고

변경 형식 문자열 :

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