您好我是使用iOS SDK的新手,我正在尝试使用姓名,地址,电子邮件等制作基本联系表单...这是我到目前为止所做的事情。
'- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)emailButton:(id)sender {
MFMailComposeViewController *mailContoller = [[MFMailComposeViewController alloc]init];
[mailContoller setMailComposeDelegate:self];
NSString *email = @"******@gmail.com";
NSString *email1 = @"*******@hotmail.co.uk";
NSArray *emailArray = [[NSArray alloc]initWithObjects:email, email1, nil];
NSString *message = [[self myTextView]text];
[mailContoller setMessageBody:message isHTML:NO];
[mailContoller setToRecipients:emailArray];
[mailContoller setSubject:@"IT WORKS!"];
[self presentViewController:mailContoller animated:YES completion:nil];
}
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
[[self myTextView] resignFirstResponder];
}
-(void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error
{
[self dismissViewControllerAnimated:YES completion:nil];
}
@end
我遇到的问题是我不知道如何制作多个文本字段,这些字段将通过电子邮件一起发送。 谢谢,任何帮助将不胜感激。
答案 0 :(得分:0)
简单地连接文本字段中的字符串。
NSString *message = [NSString stringWithFormat:@"%@\n%@\n%@",
textField1.text, textField2.text, textField3.text];