@property (nonatomic,strong) UIButton *but;
@property (nonatomic,strong) UIButton *but1;
@property (strong, nonatomic) UIView *subView;

//客服QQ
-(void)qqAction
{
    self.but = [UIButton buttonWithType:UIButtonTypeCustom];
    self.but.frame = self.view.bounds;
    self.but.backgroundColor = [UIColor colorWithWhite:0.019 alpha:0.400];
    [self.but addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:self.but];
    
    self.but1 = [UIButton buttonWithType:UIButtonTypeCustom];
    self.but1.frame = self.view.bounds;
    self.but1.backgroundColor = [UIColor colorWithWhite:0.019 alpha:0.400];
    [self.view addSubview:self.but1];
    
    [self.tabBarController.tabBar addSubview:self.but1];
    
    _subView = [[UIView alloc] initWithFrame:CGRectMake(20, screenHeight * 2, screenWidth - 40,200)];
    _subView.alpha = 0;
    _subView.layer.masksToBounds = YES;
    _subView.layer.cornerRadius = 3.0f;
    _subView.backgroundColor = [UIColor colorWithRed:255.0/255.0 green:255.0/255.0 blue:255.0/255.0 alpha:1.0];
    [self.but addSubview:_subView];
    [UIView animateWithDuration:0.001 animations:^{
        CGRect frame = self.subView.frame;
        frame.origin.y = screenHeight / 2-110;
        self.subView.frame = frame;
        self.subView.alpha = 1;
        
        UIButton *closeBtn = [[UIButton alloc] init];
        closeBtn.frame = CGRectMake(_subView.bounds.size.width - 30, 0, 30, 30);
        [closeBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        [closeBtn setImage:[UIImage imageNamed:@"btn_关闭_灰色__none"] forState:UIControlStateNormal];
        [closeBtn addTarget:self action:@selector(closeView) forControlEvents:UIControlEventTouchUpInside];
        [_subView addSubview:closeBtn];
        
        UILabel *label1 = [[UILabel alloc] initWithFrame:CGRectMake(14, 45, _subView.bounds.size.width, 30)];
        label1.text = @"钱富宝客服QQ:2797353115";
        label1.textAlignment = NSTextAlignmentLeft;
        label1.textColor = [UIColor colorWithRed:96/256.0 green:103/256.0 blue:127/256.0 alpha:1.0f];
        label1.font = [UIFont systemFontOfSize:16];
        [_subView addSubview:label1];
        
        UILabel *label2 = [[UILabel alloc] initWithFrame:CGRectMake(14, 62, _subView.bounds.size.width - 28, 60)];
        label2.text = @"注:每周一至周五8:00到18:00正常上班,节假日休息。";
        label2.numberOfLines = 2;
        label2.textAlignment = NSTextAlignmentLeft;
        label2.textColor = [UIColor colorWithRed:96/256.0 green:103/256.0 blue:127/256.0 alpha:1.0f];
        label2.font = [UIFont systemFontOfSize:16];
        [_subView addSubview:label2];
        
        UIButton *requestionBtn = [[UIButton alloc] init];
        requestionBtn.frame = CGRectMake(14, 150, _subView.bounds.size.width - 28, 43);
        [requestionBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        [requestionBtn setTitle:@"立即咨询" forState:UIControlStateNormal];
        [requestionBtn addTarget:self action:@selector(requestionClick) forControlEvents:UIControlEventTouchUpInside];
        [requestionBtn setBackgroundColor:[UIColor colorWithRed:65/256.0 green:109/256.0 blue:218/256.0 alpha:1.0f]];
        requestionBtn.layer.masksToBounds = YES;
        requestionBtn.layer.cornerRadius = 3.0f;
        
        [_subView addSubview:requestionBtn];
        
    } completion:^(BOOL finished) {
    }];
    
}

#pragma mark 在线客服网页跳转的实现部分
-(void)requestionClick{
    
    UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectZero];
    UILabel *qqLabel = [[UILabel alloc] init];
    qqLabel.text = @"2797353115";
    NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"mqq://im/chat?chat_type=wpa&uin=%@&version=1&src_type=web",qqLabel.text]];
    NSLog(@"----------%@-------",qqLabel.text);
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    webView.delegate = self;
    [webView loadRequest:request];
    [self.view addSubview:webView];
    
}
- (void)webView:(UIWebView *)webView didFailLoadWithError:(nullable NSError *)error
{
    UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:nil message:@"未安装QQ程序" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles: nil];
    [alertView show];
}

#pramra mark 打电话

//电话
-(void)hotLineAlertView
{
    self.but = [UIButton buttonWithType:UIButtonTypeCustom];
    self.but.frame = self.view.bounds;
    self.but.backgroundColor = [UIColor colorWithWhite:0.019 alpha:0.400];
    [self.but addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:self.but];
    
    self.but1 = [UIButton buttonWithType:UIButtonTypeCustom];
    self.but1.frame = self.view.bounds;
    self.but1.backgroundColor = [UIColor colorWithWhite:0.019 alpha:0.400];
    [self.view addSubview:self.but1];
    
    [self.tabBarController.tabBar addSubview:self.but1];
    
    _subView = [[UIView alloc] initWithFrame:CGRectMake(20, screenHeight * 2, screenWidth - 40,200)];
    _subView.alpha = 0;
    _subView.layer.masksToBounds = YES;
    _subView.layer.cornerRadius = 3.0f;
    _subView.backgroundColor = [UIColor colorWithRed:255.0/255.0 green:255.0/255.0 blue:255.0/255.0 alpha:1.0];
    [self.but addSubview:_subView];
    [UIView animateWithDuration:0.001 animations:^{
        CGRect frame = self.subView.frame;
        frame.origin.y = screenHeight / 2-110;
        self.subView.frame = frame;
        self.subView.alpha = 1;
        
        UIButton *closeBtn = [[UIButton alloc] init];
        closeBtn.frame = CGRectMake(_subView.bounds.size.width - 30, 0, 30, 30);
        [closeBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        [closeBtn setImage:[UIImage imageNamed:@"btn_关闭_灰色__none"] forState:UIControlStateNormal];
        [closeBtn addTarget:self action:@selector(closeView) forControlEvents:UIControlEventTouchUpInside];
        [_subView addSubview:closeBtn];
        
        UILabel *label1 = [[UILabel alloc] initWithFrame:CGRectMake(14, 45, _subView.bounds.size.width, 30)];
        label1.text = @"钱富宝客服热线:400-607-1818";
        label1.textAlignment = NSTextAlignmentLeft;
        label1.textColor = [UIColor colorWithRed:96/256.0 green:103/256.0 blue:127/256.0 alpha:1.0f];
        label1.font = [UIFont systemFontOfSize:16];
        [_subView addSubview:label1];
        
        UILabel *label2 = [[UILabel alloc] initWithFrame:CGRectMake(14, 62, _subView.bounds.size.width - 28, 60)];
        label2.text = @"注:每周一至周五8:00到18:00正常上班,节假日休息。";
        label2.numberOfLines = 2;
        label2.textAlignment = NSTextAlignmentLeft;
        label2.textColor = [UIColor colorWithRed:96/256.0 green:103/256.0 blue:127/256.0 alpha:1.0f];
        label2.font = [UIFont systemFontOfSize:16];
        [_subView addSubview:label2];
        
        UIButton *hotLineBtn = [[UIButton alloc] init];
        hotLineBtn.frame = CGRectMake(14, 150, _subView.bounds.size.width - 28, 43);
        [hotLineBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        [hotLineBtn setTitle:@"拨打热线" forState:UIControlStateNormal];
        [hotLineBtn addTarget:self action:@selector(hotLineClick) forControlEvents:UIControlEventTouchUpInside];
        [hotLineBtn setBackgroundColor:[UIColor colorWithRed:65/256.0 green:109/256.0 blue:218/256.0 alpha:1.0f]];
        hotLineBtn.layer.masksToBounds = YES;
        hotLineBtn.layer.cornerRadius = 3.0f;
        
        [_subView addSubview:hotLineBtn];
        
    } completion:^(BOOL finished) {
    }];
    
}

-(void)closeView
{
    [_but removeFromSuperview];
    [_but1 removeFromSuperview];
}

- (void)btnClick:(UIButton *)but
{
    [_but removeFromSuperview];
    [_but1 removeFromSuperview];
}
//播打热线
-(void)hotLineClick
{
    [_but removeFromSuperview];
    [_but1 removeFromSuperview];
    
    NSString *number = @"400-607-1818";
    NSString *num = [[NSString alloc]initWithFormat:@"telprompt://%@",number];
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:num]]; //拨号

}

iOS-调用网页聊天、拨打电话的更多相关文章

  1. ios app跳转拨打电话界面,调用拨打电话功能

    DNLogFUNC //两种方法都可以用 //这种据说是可以上appstore NSURL *phoneURL = [NSURL URLWithString:[NSString stringWithF ...

  2. iOS 调用短信、电话、邮件、浏览器等

    1.调用 自带mail[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"mailto://admin@hzl ...

  3. Android 打开URL中的网页和拨打电话、发送短信功能

    拨打电话需要的权限 <uses-permission android:name="android.permission.CALL_PHONE"/> 为了省事界面都写一起 ...

  4. 【原】iOS学习之三种拨打电话方式的比较

    拨打电话小编从网上找到三种,在这里做一些总结和比较 1.基本使用 NSString *str = [[NSMutableString alloc] initWithFormat:@"tel: ...

  5. Flutter移动电商实战 --(14)首页_拨打电话操作

    拨打电话的功能在app里也很常见,比如一般的外卖app都会有这个才做.其实Flutter本身是没给我们提供拨打电话的能力的,那我们如何来拨打电话那? 1.编写店长电话模块 这个小伙伴们一定轻车熟路了, ...

  6. uni-app拨打电话

    调起通讯页面拨打电话 https://uniapp.dcloud.io/api/system/phone?id=makephonecall 点击按钮直接拨打电话 <template> &l ...

  7. ios调用本地拨打电话,发送短信

    电话.短信是手机的基础功能,iOS中提供了接口,让我们调用.这篇文章简单的介绍一下iOS的打电话.发短信在程序中怎么调用. 1.打电话   [[UIApplication sharedApplicat ...

  8. iOS调用其它App,如拨打电话、发送邮件等。UIApplication:openURL:方法是实现这一目的的

    在iOS开发中,经常需要调用其它App,如拨打电话.发送邮件等.UIApplication:openURL:方法是实现这一目的的最简单方法,该方法一般通过提供的url参数的模式来调用不同的App. 通 ...

  9. iOS拨打电话的三种方式

    iOS拨打电话的三种方式 1,这种方法,拨打完电话回不到原来的应用,会停留在通讯录里,而且是直接拨打,不弹出提示 1 2 var string = "tel:" + "1 ...

  10. iOS 拨打电话三种方法

    小弟查了很多地方的关于iOS程序拨打电话,大都不全,今天我总结了三种方法,各有不同,拿来给大家分享,希望给大家有所帮助1,这种方法,拨打完电话回不到原来的应用,会停留在通讯录里,而且是直接拨打,不弹出 ...

随机推荐

  1. Java字节码方法表结构深度剖析

    继续上一次[https://www.cnblogs.com/webor2006/p/9459681.html]的字节码分析,这次来分析一下最为复杂的方法表的信息,如下: 而上一次分析到了属性表的位置在 ...

  2. 从头至尾一点点实现自己的ViewPager效果

    对于ViewPager,应该没有人在项目中没使用过它,效果非常的赞,使用也非常简单,但是如果自己来实现这样的效果,我想并非三下五除二的事了,这里涉及到怎么自定义ViewGroup了,它相比自定义Vie ...

  3. MySQL 进阶3 排序查询

    #进阶3 排序查询 格式: select 查询列名 from 表 [where 筛选条件] order by 排序列名 [asc / desc] 排序查询/嵌套排序查询/函数查询/[按别名进行 排序] ...

  4. Java基础 FileReader-FileWriter / 缓冲字符输入输出流 / 缓冲字节输入输出流 三种方式 进行文本文件的复制

    易错的地方: /** 出错的地方: * 1.缓冲流儿输出时,务必:flush();不然可能输出不尽! * 2. bw缓冲字符输出流,记得这里! bw.write(b,0,len); * 3.字符流不能 ...

  5. rabbitmq 一些属性

    消息属性 消息有14个属性,最常用的几种: deliveryMode:持久化属性 contentType:编码 replyTo:指定一个回调队列 correlationId:消息id mandator ...

  6. Java集合--整体框架

    Java集合是java提供的工具包,包含了常用的数据结构:集合.链表.队列.栈.数组.映射等.Java集合工具包位置是java.util.*Java集合主要可以划分为4个部分:List列表.Set集合 ...

  7. mysql基础篇--修改

    语法 #修改单表记录 update 表名 set 列=新值,列=新值,... where 筛选条件; #修改多表记录 update 表1 别名 inner|left|right join 表2 别名 ...

  8. 本月周六周日LIST集合

    最近项目中有用到本月所有的周六,周日,特此分享一下! 算法思路:写一个循环,条件为本月开始日期.本月截至日期,通过循环获取第一个周六,加一天就是周日,每增加六天就是下一个周六,依次类推,循环到月末 代 ...

  9. git中的基本命令

    工作区:      当前的编辑位置 缓存区:      add 之后的区域 版本库:      commit之后的区域就是版本库 git init .         初始化 git add .    ...

  10. POP3与SMTP以及python实现邮件的发送

    什么是POP3协议: POP3是Post Office Protocol 3的简称,即邮局协议的第3个版本,它规定怎样将个人计算机连接到Internet的邮件服务器和下载电子邮件的电子协议.它是因特网 ...