美文网首页
拨打电话

拨打电话

作者: 小_夭 | 来源:发表于2016-11-11 17:11 被阅读14次

let alertController = UIAlertController(title: model.telephone, message: nil, preferredStyle: .Alert)

let cancelAction = UIAlertAction(title: "取消", style: .Cancel, handler: nil)

let confirmAction = UIAlertAction(title: "呼叫", style: .Default, handler: { (alertAction) in

    let url = NSURL(string: "tel://\(10086)")

     if UIApplication.sharedApplication().canOpenURL(url!) {

          UIApplication.sharedApplication().openURL(url!)

    }

})

alertController.addAction(cancelAction)

alertController.addAction(confirmAction)

presentViewController(alertController, animated: true, completion: nil)

let url = NSURL(string: "telprompt://\(10086)")

if UIApplication.sharedApplication().canOpenURL(url!) {

UIApplication.sharedApplication().openURL(url!)

}

调用系统的打电话程序拨打电话时,上述两段代码效果相同。

相关文章

  • 拨打电话

    NSString *callPhone = [NSString stringWithFormat:@"telpro...

  • 拨打电话

    创建一个UIWebView来加载URL,拨完后能自动回到原应用if (_webView == nil) {_web...

  • 拨打客服电话

    //拨打客服 NSURL *url = [NSURL URLWithString:@"tel://40096995...

  • 拨打完电话

    1,这种方法,拨打完电话回不到原来的应用,会停留在通讯录里,而且是直接拨打,不弹出提示NSMutableStrin...

  • 拨打电话

    使用这种方式拨打电话时,可以使得用户结束通话后自动返回到应用: 使用这种方式拨打电话时,直接拨打且不能自动返回到应...

  • 拨打电话

    拨打之前判断硬件是否提供该服务 public static void callPhone(String phone...

  • 拨打电话

    方法一:不弹出提示框,直接拨打 NSMutableString *str=[[NSMutableStringall...

  • 电话拨打器

  • 拨打电话

    let alertController = UIAlertController(title: model.tele...

  • 我风雨无阻,为的不过是你不给差评

    “对不起您所拨打的电话已停机……” “对不起,您所拨打的电话暂时无法接通……” “对不起,您拨打的电话无人接听……...

网友评论

      本文标题:拨打电话

      本文链接:https://www.haomeiwen.com/subject/xwufpttx.html