整理來源: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];//釋放內(nèi)存
[string release];//釋放內(nèi)存
?3、這種方法也會回去到原來的程序里(注意這里的telprompt),也會彈出提示
NSMutableString* string=[[NSMutableString alloc] initWithFormat:@"telprompt://%@",@"電話號碼"];// ? ? ? ? ??
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:string]];