拨打电话

来源:互联网 发布:淘宝助手有什么用处 编辑:程序博客网 时间:2024/04/30 11:09

// 拨打电话方法直接拨打电话,打完电话后留在通讯录(ios8好像是回到app)

NSMutableString * str=[[[NSMutableString allocinitWithFormat:@"tel:%@",phoneNumber] autorelease];

[[UIApplication sharedApplicationopenURL:[NSURL URLWithString:str]];

            

// 拨打电话方法再弹一次提示,打完电话后可以返回程序

            

UIWebView *callWebView = [[UIWebView allocinit];

NSURL *telURL = [NSURL URLWithString:[NSString stringWithFormat:@"tel:%@",phoneNumber]];

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

[self.view addSubview:callWebView];

[callWebView release];

// 拨打电话方法3 会回去到原来的程序⾥里(注意这⾥里的telprompt),也会弹出提⽰,(审核通不过)
NSMutableString * str=[[NSMutableString allocinitWithFormat:@"telprompt://%@",@"186xxxx6979"
[[UIApplication sharedApplicationopenURL:[NSURL URLWithString:str]] 

// 如果电话号码是多个

        

       UIAlertView * alert = [[UIAlertViewalloc] initWithTitle:@"电话下单"

                                                        message:nil

                                                       delegate:self

                                              cancelButtonTitle:@"取消"

                                              otherButtonTitles:nil];

       for (int i =0; i < _phones.count; i++){

            [alert addButtonWithTitle:[_phonesobjectAtIndex:i]];

        }

        alert.tag =111;

        [alertshow];

        [alertrelease];


0 0
原创粉丝点击