NSDictionary *dic = self.names[self.titles[indexPath.section]][indexPath.row];
NSString *phone = dic[@"phoneNumber"];
//1 特点: 直接拨打, 不弹出提示。 并且, 拨打完以后, 留在通讯录中, 不返回到原来的应用。
/*
if (phone != nil) {
NSString *telUrl = [NSString stringWithFormat:@"telprompt:%@",phone];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:telUrl]];
}
*/
//2 特点: 拨打前弹出提示。 并且, 拨打完以后会回到原来的应用。注意: Apple的官方文档中, 没有出现过telprompt, 之前也有人使用这个, 上传审核的时候被拒绝了。
/*
NSMutableString * str=[[NSMutableString alloc] initWithFormat:@"telprompt://%@",phone];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];
*/
//3 特点: 拨打前弹出提示。 并且, 拨打完以后会回到原来的应用。
NSString * str=[NSString stringWithFormat:@"tel:%@",phone];
UIWebView * callWebview = [[UIWebView alloc] init];
[callWebview loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:str]]];
[self.view addSubview:callWebview];
[callWebview release];
iOS 拨打电话 拨打完以后会回到原来的应用
最新推荐文章于 2019-06-20 12:45:27 发布
本文介绍了在iOS应用中实现拨打电话功能的三种方法,并详细对比了它们的特点:直接拨打无提示、拨打前提示并返回应用及通过UIWebView实现。文中提供了具体的代码实现。

1150

被折叠的 条评论
为什么被折叠?



