美文网首页
iOS 拨打电话的3种方法

iOS 拨打电话的3种方法

作者: 前行的骆驼 | 来源:发表于2019-11-05 09:24 被阅读0次

iOS调用拨打电话的3种常用方法

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

NSMutableString *str=[[NSMutableString alloc]  initWithFormat: @"tel:%@", @"177xxxx0000"];

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];

2.创建UIWebView调用,使用这种方法,打完电话后还会回到原来的程序,也会弹出提示

NSMutableString * str=[[NSMutableString alloc] initWithFormat: @"tel:%@", @"177xxxx0000"];

UIWebView * webview = [[UIWebView alloc] init];

[webview loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:str]]];

[self.view addSubview:webview]; 

3.使用系统调用,使用这种方法会回去到原来的程序里(注意这里的telprompt),也会弹出提示

NSMutableString * str=[[NSMutableString alloc] initWithFormat: @"telprompt://%@", @"177xxxx0000"];

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];

相关文章

网友评论

      本文标题:iOS 拨打电话的3种方法

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