//  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. 如何编译Apache Hadoop2.6.0源代码

    如何编译Apache Hadoop2.6.0源代码 1.安装CentOS 我使用的是CentOS6.5,下载地址是http://mirror.neu.edu.cn/centos/6.5/isos/x8 ...

  2. jekyll 安装过程

    如果有, linux以源码包方式发布, 方便,快捷, 容易出错,安装内容难找到,版本容易冲突.兼容性会出错.如何解决这种方式:1.上网查找答案,你遇到的别人也有,关键词匹配到,好像没有别的办法解决了, ...

  3. Javascript包含对象的数组去重

    Array.prototype.clearRepeat = function(){ var result = [], obj = {}; for(var i = 0; i < this.leng ...

  4. JavaScript的面临的9个陷阱

    虽然不是什么很高深的技术问题,但注意一下,会使您的编程轻松些,即所谓make life easier. 笔者对某些陷阱会混杂一些评点. 1.   最后一个逗号 如这段代码,注意最后一个逗号,按语言学角 ...

  5. 关于CSS中对IE条件注释的问题

    一.通用区分方式:IE6.IE7能识别*,标准浏览器(如FF)不能识别*:IE6能识别*,但不能识别 !important:IE7能识别*,也能识别 !important:IE8能识别\0,不能识别* ...

  6. Xcode 8 : iOS xib is missing from working copy、iOS misssing file

    1,造成此问题可能是SVN的原因,通过命令行解决. 2.未使用SVN,竟然是icloud 造成的,通过 改变网络状态 + 重启Xcode 解决.

  7. gulp学习笔记1-定义

    1.gulp是前端开发过程中对代码进行构建的自动化工具,可以通过它提供的各种插件实现如:预编译(sass&less).压缩.合并.图片精灵等前端的重复操作 2.基于nodeJS,以js编写插件 ...

  8. java.lang.NoClassDefFoundError: [Lorg/hibernate/engine/FilterDefinition

    解决办法: 原先:<bean id="sessionFactory"class="org.springframework.orm.hibernate3.annota ...

  9. ios – 使用UINib加载xib文件实现UITableViewCell

    xib文件的实质是xml,描述界面对象,每个对象都有一个很重要的属性,identity inspector面板中class属性,加载xib文件的时候实际上是实例化界面对象相对应的这些class. xi ...

  10. 【leetcode】Word Search

    Word Search Given a 2D board and a word, find if the word exists in the grid. The word can be constr ...