开发者

passing values to the string objective c

I have a confirmation form containing different textFields like Name, Age, Phone no., 开发者_Python百科Email etc. Now i want to use them into mail and send them to the user. I have done that. My application mail is working perfectly fine.

Now i want in the mail which i sent to user through application it should contain these information in structured way. i used string like :

 NSString * bodyMessage = [NSString stringWithFormat:@"Hello  Customer Details:-  Cutomer name: %@,%@,@%",labelName.text, labelEmail.text,labelPhone.text];

But it shows unstructed data.

I want the mail should be :

Name : manjinder
Email: mann@tmail.com
Phone: 098873424345t

How can i display like this.


... = [NSString stringWithFomat:@"Name\t: %@\r\nEmail\t: %@\r\nPhone\t: %@",
                                labelName.text,
                                labelEmail.text,
                                labelPhone.text];


Try adding line breaks:

NSString * bodyMessage = [NSString stringWithFormat:@"Hello  Customer Details:-  Cutomer name: %@\n%@\n%@\n",labelName.text, labelEmail.text,labelPhone.text];


You need to use HTML line breaks in the string to accomplish that:

<br />

Just remember to set the HTML flag of the following call that you make on your MFMailComposeViewController:

[myMailController setMessageBody: myEmailBodyString isHTML:YES];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜