您的位置:首页 > 移动开发 > IOS开发

iOS 拨打电话的两种方式

2013-04-04 17:58 302 查看
第一种方式

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];
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: