//  Created by apple on 15/6/17.

//  Copyright (c) 2015年 Super All rights reserved.

//

#import "LCShareController.h"

#import <MessageUI/MessageUI.h>
@interface LCShareController () <MFMessageComposeViewControllerDelegate,MFMailComposeViewControllerDelegate>
@property (nonatomic, strong) UIWebView *webView;
@end

@implementation LCShareController
- (void)dealloc{
    NSLog(@"dealloc");
}

- (UIWebView *)webView{
    if (_webView == nil) {
        _webView = [UIWebView new];
       
    }
    return _webView;
}

- (void)setData{
   
   

//    __weak LCShareController *weakSelf = self;
   
    __weak typeof(self) weakSelf = self;
   
    LCItem *item1 = [LCItemArrow itemWithTitle:@"电话分享" icon:nil option:^{
        //通话完成会回到当前应用, 以前的时候不会回到当前应用
//        NSURL *url = [NSURL URLWithString:@"tel://1008611"];
//        [[UIApplication sharedApplication] openURL:url];
       
       
        //打电话之前会有提示  回到当前应用  私有的api
//        NSURL *url = [NSURL URLWithString:@"telprompt://10086"];
//        [[UIApplication sharedApplication] openURL:url];
       
        NSURL *url = [NSURL URLWithString:@"tel://10086"];
        NSURLRequest *request = [NSURLRequest requestWithURL:url];
        [weakSelf.webView loadRequest:request];
       
    }];
   
    LCItem *item2 = [LCItemArrow itemWithTitle:@"短信分享" icon:nil option:^{
       
        //发完短信之后。会到短信界面
//        NSURL *url = [NSURL URLWithString:@"sms://哈哈哈"];
//        [[UIApplication sharedApplication] openURL:url];
       
       
        //判断设备是否能发送信息
        if (![MFMessageComposeViewController canSendText]) {
            return;
        }
       
        MFMessageComposeViewController *vc = [MFMessageComposeViewController new];
        //收件人列表
        vc.recipients = @[@"10000",@"10086"];
        vc.body = @"推荐一个nb的游戏 http://www.nbcoder.com/test";
        vc.subject = @"biaoti";
        //设置代理
        vc.messageComposeDelegate = weakSelf;
       
        [weakSelf presentViewController:vc animated:YES completion:nil];
       
    }];
   
    LCItem *item3 = [LCItemArrow itemWithTitle:@"邮件分享" icon:nil option:^{
       
        //判断是否能发送邮件
        if (![MFMailComposeViewController canSendMail]) {
            return;
        }
       
        MFMailComposeViewController *vc = [MFMailComposeViewController new];
       
        vc.mailComposeDelegate = weakSelf;
        //设置收件人
        [vc setToRecipients:@[@"super1250@126.cn",@"2222@126.cn"]];
        //密送
//        [vc setBccRecipients:<#(NSArray *)#>]
        //抄送
//        [vc setCcRecipients:<#(NSArray *)#>]
       
        [vc setSubject:@"收福利了"];
        [vc setMessageBody:@"送美女" isHTML:NO];
       
        //
        UIImage *img = [UIImage imageNamed:@"aa"];
        NSData *data = UIImagePNGRepresentation(img);
       
        [vc addAttachmentData:data mimeType:@"image/png" fileName:@"cls.png"];
       
       
       
        [weakSelf presentViewController:vc animated:YES completion:nil];
       
    }];
   
    //controller(self) --> self.groups -->  group  -->  item   --> option  --> self
   
    LCGroup *group = [LCGroup groupWithItems:@[item1,item2,item3]];
    self.groups = @[group];
}

- (void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error{
    [controller  dismissViewControllerAnimated:YES completion:nil];

}

- (void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result{
    [controller  dismissViewControllerAnimated:YES completion:nil];
}

@end

supersr--打电话/短信分享/邮件分享的更多相关文章

  1. iOS调用系统发送短信和邮件分享

    //发送邮件 -(void)sendMail:(NSString*)subject content:(NSString*)content{ MFMailComposeViewController*co ...

  2. ios 设置亮度、声音;调用发短信、邮件、打电话

    一,设置亮度 [[UIScreen mainScreen] setBrightness:0.5];//0.0~1.0 二,设置声音 1,添加 MediaPlayer.framework 框架 2,在需 ...

  3. Android实例-打电话、发短信和邮件,取得手机IMEI号(XE8+小米2)

    结果: 1.不提示发短信卡住,点击没有反映,我猜想,可能是因为我用的是小米手机吧. 2.接收短信报错,我猜想可能是我改了里面的方法吧(哪位大神了解,求指教). 3.project -->opti ...

  4. IOS中调用系统的电话、短信、邮件、浏览功能

    iOS开发系列--通讯录.蓝牙.内购.GameCenter.iCloud.Passbook系统服务开发汇总 2015-01-13 09:16 by KenshinCui, 26990 阅读, 35 评 ...

  5. ios开发——实用技术篇Swift篇&地址薄、短信、邮件

    //返回按钮事件 @IBAction func backButtonClick() { self.navigationController?.popViewControllerAnimated(tru ...

  6. react-native-communications 电话、短信、邮件、浏览器

    第一种方法:Linking:调用系统的电话.短信.邮件.浏览器等功能 Linking.canOpenURL(this.props.url).then(supported => { if (!su ...

  7. HTML5的头部、拨号、短信、邮件(转)

    HTML5[语法要点] 一.头部设置 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 <!--页面窗口自动调整到设备 ...

  8. iOS学习笔记28-系统服务(一)短信和邮件

    一.系统应用 在开发某些应用时,我们可能希望能够调用iOS系统内置的电话.短信.邮件.浏览器应用,或者直接调用安装的第三方应用,这个要怎么实现呢? 这里统一使用UIApplication的一个对象方法 ...

  9. MVC使用ASP.NET Identity 2.0实现用户身份安全相关功能,比如通过短信或邮件发送安全码,账户锁定等

    本文体验在MVC中使用ASP.NET Identity 2.0,体验与用户身份安全有关的功能: →install-package Microsoft.AspNet.Identity.Samples - ...

  10. app后端设计(3)--短信,邮件,推送服务(2014.12.05更新)

    在app的后端设计中,免不了消息的推送,短信,邮件等服务,下面就个人的开发经验谈谈这方面. (1)最重要的是,各种推送一定要放在队列系统中处理,不然会严重影响api的响应时间. (2)短信方面 以前我 ...

随机推荐

  1. git学习教程

    猴子都能懂的GIT入门 http://backlogtool.com/git-guide/cn/ 廖雪峰的Git教程 http://www.liaoxuefeng.com/wiki/001373951 ...

  2. hdu.5212.Code(莫比乌斯反演 && 埃氏筛)

    Code Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submi ...

  3. Jetty安装

    下载jetty http://www.eclipse.org/jetty/  看好jdk 版本 安装 解压压缩包到指定目录,且将其目录路径定义为${JETTY_HOME} 进入${JETTY_HOME ...

  4. Mac Pro 修改主机名

    修改 主机名称 sudo scutil --set HostName jianbao-PC 修改 共享名称 sudo scutil --set ComputerName jianbao-PC

  5. WPF:自定义路由事件的实现

    路由事件通过EventManager,RegisterRoutedEvent方法注册,通过AddHandler和RemoveHandler来关联和解除关联的事件处理函数:通过RaiseEvent方法来 ...

  6. svn 设置post-commit后 报错svn: Can't convert string from 'UTF-8' to native encoding

    文件语言编码和系统冲突导致的错误,设置svn目录下hooks/post-commit加上: export LANG=zh_CN.GB2312 或者: export LANG=zh_CN.UTF-8

  7. CentOS 6.5 安装nginx 1.6.3

    使用epel [root@nginx /]# wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo ...

  8. 锋利的jQuery书中推荐的几款插件

    1.jQuery表单验证插件——Validation 2.jQuery表单插件——Form 3.模态窗口插件——SimpleModal 4.管理Cookie的插件——Cookie 5.jQuery U ...

  9. 一种map容器遍历的方法

    遍历算法是一种很常见而且非常重要的算法,我们用map容器的时候可能用的比较多的是查找,我今天才第一次要用到遍历.下面举个例子就知道了. map<string,string> mp; str ...

  10. python 环境安装

    wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz  tar zxf Python-2.7.3.tgz  cd Python-2. ...