以编程方式在iPhone上发出呼叫并在挂断后返回到同一个应用程序 [英] placing a call programmatically on iPhone and return to the same app after hangup

查看:78
本文介绍了以编程方式在iPhone上发出呼叫并在挂断后返回到同一个应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我会撒谎在我的应用程序中拨打电话(我可以使用电话:),但我想在用户挂机后返回我离开的应用程序。
这可能吗?

I would lie to place a call in my app (I can use the tel:) but I would like to return to my app where I left after the users hangs up. Is that possible?

推荐答案

我从Apple网站获得此代码并且运行正常:

I got this code from Apple site and it works perfectly:

-(IBAction) dialNumber:(id)sender{

NSString *aPhoneNo = [@"tel://" stringByAppendingString:[itsPhoneNoArray objectAtIndex:[sender tag]]] ; NSURL *url= [NSURL URLWithString:aPhoneNo];

NSString *osVersion = [[UIDevice currentDevice] systemVersion];

if ([osVersion floatValue] >= 3.1) { 
UIWebView *webview = [[UIWebView alloc] initWithFrame:[UIScreen mainScreen].applicationFrame]; 
[webview loadRequest:[NSURLRequest requestWithURL:url]]; 
webview.hidden = YES; 
// Assume we are in a view controller and have access to self.view 
[self.view addSubview:webview]; 
[webview release]; 
} else { 
// On 3.0 and below, dial as usual 
[[UIApplication sharedApplication] openURL: url];
}


}

这篇关于以编程方式在iPhone上发出呼叫并在挂断后返回到同一个应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆