【问题标题】:How to show email sent notification ipad如何显示电子邮件已发送通知 ipad
【发布时间】:2012-07-19 20:47:39
【问题描述】:

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

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

谢谢。

【问题讨论】:

  • 你用的是什么邮件控制器?

标签: iphone objective-c ios xcode ipad


【解决方案1】:

如果你使用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
}

【讨论】:

  • 记得释放警报;)
  • @Cupcake,太习惯了ARC:D,你会加起来的。
  • 感谢所有 Stack Overflow 成员。这是最好的网站,你们是最好的!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-12-08
  • 2011-05-18
  • 1970-01-01
相关资源
最近更新 更多