zoukankan      html  css  js  c++  java
  • ios 打电话结束返回到应用中

    在我们做打电话这个功能时,我们常常是调用这个方法:

    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://xxxxx"]];


    然而,这样实现了功能后,结束通话后,确不能回到自己的应用中来。最近在网上搜了很多,苹果自己是没有提供回调函数的。强大的网友们通过用 UIWebView这个控件实现了这个方法。

    代码如下:

    - (void) dialPhoneNumber:(NSString *)aPhoneNumber  
    {  
        NSURL *phoneURL = [NSURL URLWithString:[NSString stringWithFormat:@"tel:%@",aPhoneNumber]];  
        if ( !phoneCallWebView ) {          
            phoneCallWebView = [[UIWebView alloc] initWithFrame:CGRectZero];  
        }  
        [phoneCallWebView loadRequest:[NSURLRequest requestWithURL:phoneURL]];  
    }  
    - (void) dealloc  
    {  
        // cleanup  
        [phoneCallWebView release], phoneCallWebView = nil;  
       [super dealloc];  
    }  


    还有一种不能上传到appstore上的方法。

    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"telprompt://xxxx"]];  
    


    也就是将tel改为了telprompt


     

    大家可以尝试下。




  • 相关阅读:
    安装go版本
    golang简介
    安装MySQL
    art.dialog.art 中,将子页面窗口中的值传递给父框架中
    Windows7下安装CentOS
    生成uuid
    如何开启win7端口的图文教程
    PHPMailer不能发送邮件
    sql 如果关联表 没有值 设置 默认值
    php array 分页
  • 原文地址:https://www.cnblogs.com/pangblog/p/3260658.html
Copyright © 2011-2022 走看看