iOS 拨打电话代码

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

NSMutableString *phone = [[NSMutableString alloc] initWithFormat:@"tel:%@",@"@"188*****958"];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];

2,这种方法,打完电话后会自动返回到原来的程序,也会弹出提示,推荐

NSMutableString *phone=[[NSMutableString alloc] initWithFormat:@"tel:%@",@"188*****958"];
UIWebView *callWebview = [[UIWebView alloc] init];
[callWebview loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:phone]]];
[self.view addSubview:callWebview];

3,这种方法也会返回到原来的程序里(注意这里的telprompt),也会弹出提示

NSMutableString *phone=[[NSMutableString alloc] initWithFormat:@"telprompt://%@",@"@"188*****958"];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];

你可能感兴趣的:(iOS 拨打电话代码)