I have a table view with four sections. The cell of one of the sections contains the email address. When i click on that cell i open mail view controller. Now when i click on the cancel button which is present on the navigation bar, an action sheet appears in which there are three buttons. One of those three buttons is cancel button. Now i want to return back to the table view when i click on this cancel button of action sheet. i have tried all the possible methods including
-(void)mailComposeController:
(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error
method of MFMailComposeViewController
delegate.
Please help me out. Here is my code :
if(indexPath.section == 2)
{
if([MFMailComposeViewController canSendMail])
{
MFMailComposeViewController *mailcontroller = [[MFMailComposeViewController alloc]init];
[mailcontroller.mailComposeDelegate self];
[mailcontroller setToRecipients:[[NSArray alloc]initWithObjects:record.contactemail, nil]];
[self presentViewController:mailcontroller animated:YES completion:nil];
}
}
-(void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error
{
[self dismissViewControllerAnimated:YES completion:nil];
}