iOS应用拨打电话

方法一:

特点: 直接拨打, 不弹出提示。 并且, 拨打完以后, 留在通讯录中, 不返回到原来的应用。  

//拨打电话  
- (void)callPhone:(NSString *)phoneNumber  
{  
    //phoneNumber = "18369......"  
    NSMutableString * str=[[NSMutableString alloc] initWithFormat:@"tel:%@",phoneNumber];  
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];  
}  

  

方法二:

特点: 拨打前弹出提示。 并且, 拨打完以后会回到原来的应用

//拨打电话  
- (void)callPhone:(NSString *)phoneNumber  
{  
    //phoneNumber = "18369......"  
    NSMutableString * str=[[NSMutableString alloc] initWithFormat:@"tel:%@",phoneNumber];  
    UIWebView * callWebview = [[UIWebView alloc] init];  
    [callWebview loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:str]]];  
    [self.view addSubview:callWebview];  
} 

  

posted @ 2016-01-20 09:40  LeoMabi  阅读(199)  评论(0)    收藏  举报