码迷,mamicode.com
首页 > 移动开发 > 详细

iOS 三种打电话方式

时间:2015-03-05 14:22:05      阅读:114      评论:0      收藏:0      [点我收藏+]

标签:

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

  NSMutableString * str=[[NSMutableString alloc] initWithFormat:@"tel:%@",@"000000000"];

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

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

 

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

 NSMutableString * str=[[NSMutableString alloc] initWithFormat:@"tel:%@",@"00000000000"];

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

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

 

//    // 提示:不要将webView添加到self.view,如果添加会遮挡原有的视图

//    // 懒加载

//    if (_webView == nil) {

//        _webView = [[UIWebView alloc] init];

//    }

//    NSLog(@"%p", _webView);

//    

//    NSURL *url = [NSURL URLWithString:@"tel://xxxxxxx"];

//    NSURLRequest *request = [NSURLRequest requestWithURL:url];

//    

//    [_webView loadRequest:request];

 

 

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

 NSMutableString * str=[[NSMutableString alloc] initWithFormat:@"telprompt://%@",@"000000000"];

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

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

 

iOS 三种打电话方式

标签:

原文地址:http://www.cnblogs.com/itlover2013/p/4315600.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!