开发者

Getting UITextField value and sending it with in a in-app email

I have one UITextField that has a value and one UILabel that has text. I have added an in-app email button that works. I would like to add the UITextField's value and the UILabel's text to the body of the email. Example code:

if ([MFMailComposeViewController canSendMail]) {
    [composer s开发者_高级运维etToRecipients:[NSArray arrayWithObjects:@"tkw1976@gmail.com" , nil]];
    [composer setSubject:@"Subject"];
    [composer setMessageBody:@"This is the body" isHTML:NO];

    [self presentModalViewController:composer animated:YES];

I would like the messageBody to look like this:

sandwiches(UILabel) 10(UITextField)


You're practically there. Make connections for your UILabel and UITextField, and then set the text of the message by

NSString *message = [NSString stringWithFormat:@"sandwiches %@ 10 %@",label.text,textField.text];
[composer setMessageBody:message isHTML:NO];
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜