开发者

MFMailComposeViewController : exit on cancel

开发者 https://www.devze.com 2023-01-11 14:46 出处:网络
i have the following code presenting the user with email from within the app : MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];

i have the following code presenting the user with email from within the app :

MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self; 
[picker setSubject:@"Subject"];
NSString* link = [NSString stringWithFormat:@"<a href='%@'>Report</a>",link];
[picker setMessageBody:link isHTML:YES];
picker.navigationBar.barStyle = UIBarStyleDefault; 
[self presentModalViewController:picker animated:YES];
[picker release];

and allso :

- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error{ 
    [self dismissModalViewControllerAnimated:YES];
}

everything works just fine , expect that i'd like the cancel to skip the delete draft/save draft/cancel stage开发者_开发知识库 and basicly chose the delete draft (not present it to the user) can this be done ? thanks


- (void)mailComposeController:(MFMailComposeViewController *) controller didFinishWithResult:(MFMailComposeResult) result error:(NSError *)error
    {
        switch (result) {
            case MFMailComposeResultCancelled:
                break;

            case MFMailComposeResultSaved:
                break;

            case MFMailComposeResultSent:
                break;

            case MFMailComposeResultFailed:
                break;

            default:
                break;
        }

        //Dismiss the mailViewController.
        [self dismissModalViewControllerAnimated:YES];
    }

Is this what you are looking for? You can then handle each error or completion individually!

0

精彩评论

暂无评论...
验证码 换一张
取 消