iOS 拨打电话的两种方式
时间:2014-09-04 00:15:37
收藏:0
阅读:240
第一种方式
NSString *phone = @“88888888”
if (phone != nil) {
NSString *telUrl = [NSString stringWithFormat:@"telprompt:%@",phone];
NSURL *url = [[NSURL alloc] initWithString:telUrl];
[[UIApplication sharedApplication] openURL:url];
}
第二种方式
UIWebView*callWebview =[[UIWebView alloc] init];
NSString *telUrl = [NSString stringWithFormat:@"tel:%@",phone];
NSURL *telURL =[NSURL URLWithString:telUrl];// 貌似tel:// 或者 tel: 都行
[callWebview loadRequest:[NSURLRequest requestWithURL:telURL]];
//记得添加到view上
[self.view addSubview:callWebview];
原文:http://blog.csdn.net/chenhongyi_1992/article/details/39036097
评论(0)