(ios)拨打电话

整理来源:iOS拨打电话(三种方法)


1、此方法,拨打完电话回不到原来的应用,会停留在通讯录里,而且是直接拨打,不弹出提示

NSMutableString* string=[[NSMutableStringalloc]initWithFormat:@"tele:%@",@"电话号码"];//          

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:string]];

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

NSMutableString* string=[[NSMutableStringalloc]initWithFormat:@"tele:%@",@"电话号码"];

UIWebView* webview = [[UIWebView alloc] init];

[webview  loadRequest:[NSURLRequest  requestWithURL:[NSURL URLWithString:string]]]; 

[self.viewaddSubview:webview];

[webview release];//释放内存

[string release];//释放内存

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

NSMutableString* string=[[NSMutableString alloc] initWithFormat:@"telprompt://%@",@"电话号码"];//           

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:string]];

你可能感兴趣的:((ios)拨打电话)