IOS之拨打电话的三种方式

// 1,这种方法,拨打完电话回不到原来的应用,会停留在通讯录里,而且是直接拨打,不弹出提示

   NSMutableString * str1=[[NSMutableString alloc] initWithFormat:@"tel:%@",@"13913013703"];

            NSLog(@"str======%@",str);

    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:str1]];

    

   //2,这种方法,打完电话后还会回到原来的程序,也会弹出提示,推荐这种

    NSMutableString * str2=[[NSMutableString alloc] initWithFormat:@"tel:%@",@"13913013703"];

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

    [callWebview loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:str2]]];

    [self.view addSubview:callWebview];

    [callWebview release];

   [str release];

   

 

   //3,这种方法也会回去到原来的程序里(注意这里的telprompt),也会弹出提示

    NSMutableString * str3=[[NSMutableString alloc] initWithFormat:@"telprompt://%@",@"13913013703"];                 

    NSLog(@"str======%@",str);

   [[UIApplication sharedApplication] openURL:[NSURL URLWithString:str3]];

 

posted @ 2015-08-06 17:15  朱峰博客  阅读(281)  评论(0编辑  收藏  举报