//  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. JS快速获取图片宽高的方法

    快速获取图片的宽高其实是为了预先做好排版样式布局做准备,通过快速获取图片宽高的方法比onload方法要节省很多时间,甚至一分钟以上都有可能,并且这种方法适用主流浏览器包括IE低版本浏览器. 我们一步一 ...

  2. navigationcontroller剖析

    概述: 系统原生的navigationcontroller非常强大, 几乎所有的程序都基于系统的导航控制器做开发 它的navigationbar的有2种形态 navigationbar的frame其实 ...

  3. ducument.ready不生效的问题 ruby on rails

    rails web app页面之间的跳转的时候使用ducument.ready只有在再次加载的时候才生效, 因为rails用了turbolinks, https://github.com/turbol ...

  4. ios10 UNNtificationRequest UNUserNotificationCenter的应用 推送之本地推送

    iOS10 已经 "deprected" 我们的UILocalNotification 采用了全新的UNUserNotificationCenter; 1 首先,你需要引进< ...

  5. Struts2中关于"There is no Action mapped for namespace / and action name"的总结

    今天在调试一个基础的Struts2框架小程序.总是提示"There is no Action mapped for namespace / and action name"的错误. ...

  6. HDU 2222 ----AC自动机

    Problem Description In the modern time, Search engine came into the life of everybody like Google, B ...

  7. HackerRank savita-and-friends

    Description 在一条边上求一个点,使得这个点到所有点的最长的最短距离 最短. \(n \leqslant 10^5\) Sol Dijkstra+扫描线+单调队列. 这个好像叫什么最小直径生 ...

  8. python gui之tkinter事件处理

    事件一览表 事件 代码 备注 鼠标左键单击按下 1/Button-1/ButtonPress-1   鼠标左键单击松开 ButtonRelease-1   鼠标右键单击 3   鼠标左键双击 Doub ...

  9. Redis常用数据类型介绍、使用场景及其操作命令

    Redis常用数据类型介绍.使用场景及其操作命令 本文章同时也在cpper.info发布. Redis目前支持5种数据类型,分别是: 1.String(字符串) 2.List(列表) 3.Hash(字 ...

  10. 【云计算】marathon集群如何升级?

    Upgrading to a Newer Version We generally recommend creating a backup of the ZooKeeper state before ...