iOS 拨打电话的三种方式
2018-10-04 本文已影响0人
风冰武
1:直接拨打, 不会弹出提示框
NSString *phone = [NSString stringWithFormat:@"tel:%@", @"150xxxxxxxx"];
[UIApplication.sharedApplication openURL:[NSURL URLWithString:phone] options:@{} completionHandler:nil];
2: 会弹出提示框
NSString *phone = [NSString stringWithFormat:@"tel:%@",@"150xxxxxxxx"];
UIWebView *callWebView = UIWebView.new;
[callWebView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:phone]]];
[self.view addSubview:callWebView];
3:会弹出提示框(注意:这里是telprompt, 推荐用这种)
NSString *phone = [NSString stringWithFormat:@"telprompt://%@",@"150xxxxxxxx"];
[UIApplication.sharedApplication openURL:[NSURL URLWithString:phone] options:@{} completionHandler:nil];