IOS 拨打电话的两种方式

第一种方式 


NSString *tel = @“123456789”


    if (tel != nil) {

        

        NSString *telUrl = [NSString stringWithFormat:@"telprompt:%@",tel];

        

        NSURL *url = [[NSURL alloc] initWithString:telUrl];

        

        [[UIApplication sharedApplication] openURL:url];

}


第二种方式 



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

         NSString *telUrl = [NSString stringWithFormat:@"tel:%@",phone];

         NSURL *telURL =[NSURL URLWithString:telUrl];// 貌似tel:// 或者 tel: 都行

         [callweb loadRequest:[NSURLRequest requestWithURL:telURL]];

         //记得添加到view

         [self.view addSubview:callweb];




你可能感兴趣的:(ios,call,打电话,phone,tel,IOS拨打电话)