iOS 拨打电话三种方式

时间:2022-11-10 14:34:39
 1 1,这种方法,拨打完电话回不到原来的应用,会停留在通讯录里,而且是直接拨打,不弹出提示
2 NSMutableString * str=[[NSMutableString alloc] initWithFormat:@"tel:%@",@"186xxxx6979"];
3 // NSLog(@"str======%@",str);
4 [[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];
5
6
7 2,这种方法,打完电话后还会回到原来的程序,也会弹出提示,推荐这种
8 NSMutableString * str=[[NSMutableString alloc] initWithFormat:@"tel:%@",@"186xxxx6979"];
9 UIWebView * callWebview = [[UIWebView alloc] init];
10 [callWebview loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:str]]];
11 [self.view addSubview:callWebview];
12 [callWebview release];
13 [str release];
14
15
16
17
18 3,这种方法也会回去到原来的程序里(注意这里的telprompt),也会弹出提示
19 NSMutableString * str=[[NSMutableString alloc] initWithFormat:@"telprompt://%@",@"186xxxx6979"];
20 // NSLog(@"str======%@",str);
21 [[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];