-4

这就是我点击时用来邮寄的东西

- (IBAction)email:(id)sender {
    if ([MFMailComposeViewController canSendMail]) {

        MFMailComposeViewController *mailViewController = [[MFMailComposeViewController alloc] init];
        mailViewController.mailComposeDelegate = self;
        [mailViewController setSubject:@"Subject Goes Here."];

         [mailViewController setMessageBody:@"Your message goes here." isHTML:NO];

          [self presentModalViewController:mailViewController animated:YES];
          [mailViewController release];


          }

          else {

              NSLog(@"Device is unable to send email in its current state.");

          }

现在当我点击它时有一个邮件按钮然后该视图出现用于撰写邮件所以在按钮旁边有一个名为_emailTextField的文本字段所以我想要的是当点击按钮时该文本字段应该出现在撰写邮件视图中,就像在文本字段中一样有 hell@yahoo.com 然后在 TO 的 mailview 中它应该是 hell@yahoo 作为收件人

请告诉我该怎么做?

4

3 回答 3

3
  NSArray *recipentsArray = [[NSArray alloc]initWithObjects:@"xxx@gmail.com", nil];
 [mailViewController setToRecipients:recipentsArray];
于 2013-04-08T12:56:39.577 回答
1

您可以使用 :

[mailViewController setToRecipients:[NSArray arrayWithObject: _emailTextField.text,nil]];
于 2013-04-08T12:56:10.400 回答
0
mailViewController.recipients = [NSArray arrayWithObjects:@"abc@xyz.com",nil];
于 2013-04-08T12:59:26.527 回答