placing a call programmatically on iPhone and retu

2019-03-22 06:56发布

This question already has an answer here:

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?

标签: iphone tel
3条回答
手持菜刀,她持情操
2楼-- · 2019-03-22 07:17

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


}
查看更多
叛逆
3楼-- · 2019-03-22 07:25

No it's not. The user controls where they navigate after the phone call has ended I'm afraid. by default, it stays in the phone application, and the only way for the user to exit out of it is to hit the home button, which takes them to their main screen. Save your state, and reload it when they come back like everyone else.

查看更多
女痞
4楼-- · 2019-03-22 07:37

You cannot return to the app automatically, after the call completes, but if your app supports iOS 4, its multitasking features (if the app supports them) can bring the user back to the spot where he or she left off before the call, when the app is relaunched.

If you use iOS 3 or earlier, you will need to manually save the app's state yourself and then bring the user back to that state on relaunch.

查看更多
登录 后发表回答