-1

嗨,我是使用 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

我遇到的问题是我不知道如何制作将通过电子邮件一起发送的多个文本字段。谢谢,任何帮助将不胜感激。

4

1 回答 1

1

只需连接文本字段中的字符串。

NSString *message = [NSString stringWithFormat:@"%@\n%@\n%@",
     textField1.text, textField2.text, textField3.text];
于 2013-09-24T12:51:48.300 回答