码迷,mamicode.com
首页 > 其他好文 > 详细

通过email分享

时间:2014-07-01 11:39:20      阅读:134      评论:0      收藏:0      [点我收藏+]

标签:os   html   htm   res   ui   text   

MFMailComposeViewController *mailC=[[MFMailComposeViewControlleralloc] init];

            if ([MFMailComposeViewControllercanSendMail]) {

                mailC.mailComposeDelegate=self;

                [mailC setSubject:@"I have a something to do"];

                NSString *emailBody = @"this is text email";

                [mailC setMessageBody:emailBody isHTML:YES];

                [selfpresentModalViewController:mailC animated:YES];

            }

            [mailC release]; 

-(void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult :(MFMailComposeResult)result error:(NSError*)error {

    NSString *msg;

    switch (result)

    {

        case MFMailComposeResultCancelled:

            msg = @"邮件发送取消";

            break;

        case MFMailComposeResultSaved:

            msg = @"邮件保存成功";

           // [self alertWithTitle:nil msg:msg];

            break;

        case MFMailComposeResultSent:

            msg = @"邮件发送成功";

            //[self alertWithTitle:nil msg:msg];

            break;

        case MFMailComposeResultFailed:

            msg = @"邮件发送失败";

            //[self alertWithTitle:nil msg:msg];

            break;

        default:

            break;

    }

    UIAlertView *al = [[UIAlertViewalloc] initWithTitle:msg message:@""delegate:nilcancelButtonTitle:@"OK"otherButtonTitles:nil];

    [al show];

    [al release];

   // NSLog(@"msg=%@",msg);

    [selfdismissModalViewControllerAnimated:YES];

}

要添加messageui.framework!需要包含#import <MessageUI/MessageUI.h>

通过email分享,布布扣,bubuko.com

通过email分享

标签:os   html   htm   res   ui   text   

原文地址:http://www.cnblogs.com/dokaygang128/p/3817486.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!