当前位置:首页 > 操作系统 > Ios

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];  
} 

原文:http://www.cnblogs.com/LeoMabi/p/5144102.html


【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!