第一种:
NSMutableString *string = [[NSMutableString alloc] initWithFormat:@"tel:%@",@"15139877951"];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:string]];
注:拨打完电话后回不到原来的应用,会停留在通讯录里,而且是直接拨打不弹出提示。
第二种:
UIWebView *web = [[UIWebView alloc] init];[self.view addSubview:web];
NSMutableString *string = [[NSMutableString alloc] initWithFormat:@"tel:%@",@"15139877951"];
[web loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:string]]];
注:拨打电话后还会回到原来的程序,也会弹出提示(推荐使用)
第三种:
NSMutableString *string = [[NSMutableString alloc] initWithFormat:@"telprompt:%@",@"15139877951"];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:string]];
注:拨打电话后会回到原来的程序里,也会弹出提示,但是注意这里的是telprompt