• 通过email分享


    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>

  • 相关阅读:
    Mac使用pip安装Tensorflow
    php之curl get post curl_multi_exec 请求用法
    重新捡起的知识-字节(Byte)、比特(bit)-计算机常识
    Mac打不开Wireshark dyld: Library not loaded: /usr/X11/lib/libcairo.2.dylib
    ViewController生命周期
    转 try catch finally
    VPS centOS搭建gitlab小结
    UIButton小节
    python 统计单词个数,并按个数与字母排序
    GCP 谷歌云平台申请教程
  • 原文地址:https://www.cnblogs.com/dokaygang128/p/3817486.html
Copyright © 2020-2023  润新知