一旦我的应用程序的用户发送了一封电子邮件,并看到一个UIAlert通知他们他们的电子邮件已成功发送,他们的id就像他们一样,然后通过segue被带回主屏幕。此时用户必须按下后退按钮才能实现此目的。电子邮件发送后激活segue
我感觉它应该在mailComposeController方法中实现,但我从来没有以编程方式激活一个segue。下面
我的代码给出:
-(void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error{
switch (result) {
case MFMailComposeResultCancelled:
{
[self dismissViewControllerAnimated:YES completion:nil];
}
break;
case MFMailComposeResultSent:
{
[self dismissViewControllerAnimated:YES completion:nil];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Disclaimer", "")
message:NSLocalizedString(@"Thank you for Dobbing in a Hoon. You will shortly receive an email from Council. Please be aware that the Police are responsible for actioning your requests.", "")
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles: nil];
[alert show];
break;
}
case MFMailComposeResultFailed:
{
[self dismissViewControllerAnimated:YES completion:nil];
UIAlertView *alert_failed = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Email Failure", "")
message:NSLocalizedString(@"Your Email Failed to send - Please try Again", "")
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles: nil];
[alert_failed show];
break;
}
default:
break;
}
- (void)alertView:(UIAlertView *)alert clickedButtonAtIndex:(NSInteger)buttonIndex;
{
if (buttonIndex != alert.cancelButtonIndex) {
[self performSegueWithIdentifier:@"hoonToHome" sender:self];
}
}
是否在'[alert show]'之前或之后实现了它? – scb998
@ scb998我的编辑 – Johnykutty
但你不能在我的mailComposeController方法中放置一个方法? – scb998