0

我有一个成功发送电子邮件的邮件控制器。

但是我想在发送电子邮件时显示“电子邮件发送成功”的通知。有没有办法做到这一点?

谢谢。

4

1 回答 1

2

如果您正在使用MFMailComposeViewController,则可以使用其委托方法。

1.设置委托:mailController.mailComposeDelegate=self;

2.然后使用委托方法`

 - (void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error
{
   if(result == MFMailComposeResultSent)
  {
      UIAlertView*sentalert=[[UIAlertView alloc] initWithTitle:@"Mail Sent succesfully!" message:nil delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
      [sentalert show]; 
      [sentalert release]; // if not using ARC
  }

  [self dismissModalViewControllerAnimated:YES]; //Dismiss your mail controller
}
于 2012-07-13T11:35:49.230 回答