从iPhone应用程序发送电子邮件时,点击发送按钮后如何调用方法



我从iphone应用程序发送电子邮件,我想当用户点击电子邮件的发送按钮后,它应该调用test()方法任何想法如何做到这一点,我使用以下代码。

NSString * emailBody =@"<html><body>Thank you for your participation in Consulting<br>Practitioner and Client Program.</br><br>Attached is the copy of your signed contract for your records<p>Please email or fax your completed W-9 form to<br>our PEI Support Team<br>Email:PEISupportServices@zoetis.com<br>Fax:800-741-1310<body></html>";

[picker setMessageBody:emailBody isHTML:YES];


[self.navigationController presentViewController:picker animated:YES completion:nil];


}
}

 [self test];    

}

请尝试实现这个委托方法?它在用户退出作曲器后被调用。

    - (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error  {   
    NSString *message = @"";
    // Notifies users about errors associated with the interface
    switch (result) {
        case MFMailComposeResultCancelled:
            message = @"Mail: canceled";
            break;
        case MFMailComposeResultSaved:
            message = @"Mail: saved";
            break;
        case MFMailComposeResultSent:
            message = @"Mail: sent";
//------- call your test method here 
            break;
        case MFMailComposeResultFailed:
            message = @"Mail: failed";
            break;
        default:
            message = @"Mail: not sent";
            break;
    }
    [self dismissModalViewControllerAnimated:YES];
    }

最新更新