i want to open dial pad when user click on call button and then user enter phone number and call it
i know we can make call like this
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"telprompt://2135554321"]];
but i want to open dial pad and then let user enter number and press call button to call
if this is not possible then want to do something like my app open direct to dail pad then user call it and then it should redirect to my app
No you cant do this in iOS . iPhone SDK not gives you direct access to dial a numbers from the application .The one way to achieve this is
take a text field
textfield.keyboardType = UIKeyboardTypePhonePad;
and
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:#"tel://%#",textfield.text]]];
You have to see the format for entering the number.
Why not create a UIView that has a "UITextField" and when the text field comes up, have the keyboard set to only be numbers (i.e. pretty much the same thing as the dialpad).
And once they are done entering in the number, then you can call the "openURL" line you have above.
Related
The problem is: I don't want to dial immediately, I need when user taps the 'call' button, app jumps to dial pad in phone app, aand user enter's the phone number,then user can press 'Call' button to make this phone call.
[[UIApplication sharedApplication] openURL:#"tel://"]
This is not possible, however why don't you like the 'tel://' method since it keeps the user in your app once the call terminates? I haven't seen a single app that redirects to the call screen to dial a number since the call button is more simpler.
I know we can make a phone call programmatically on iOS, and it opens the phone app and display the phone number. Is there a way to hide the phone number or show something else instead of the phone number?
Thanks.
You could make a contact for it so it shows the name of the contact name instead of the phone number, but there is no possible way to actually hide the phone number the user is calling.
You can not display name programatically when calling, because iOS does not provide you any mechanism in which you can pass name with phone number. The only way is you have to first save phone number with your desired name as a contact into user's phone and after that make a call programatically.
To make a phone call, use [[UIApplication sharedApplication] openURL:#"tel://"] it's very easy.
The problem is: I don't want to dial immediately, I need when user taps the 'call' button, app jumps to dial pad in phone app, and displays specific phone number, user can press 'Call' button to make this phone call.
Anybody know how can I achieve this?
Appreciate!
iPhone SDK not allows you to dial a number from the application. But you can do it by using a UITextField. Set keyboard type to UIKeyboardTypePhonePad
textfield.keyboardType = UIKeyboardTypePhonePad;
and set that number to textfield,
textfield.text = numberToDial;
and then call the following line when user taps on your call button
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:#"tel://%#",textfield.text]]];
If I use the UIDataDetectorTypePhoneNumber on a UITextView, and click a phone number on a device that has no phone (e.g. iPad), I get a Send Message / Add to Contacts / Copy popover. Is there some way to bring up that dialog directly in code or would I have to reimplement?
I did try [[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"tel:5555555"]]; but that does not bring up the dialog.
There are some subtle differences between how detected links and buttons behave and my client wants a clickable phone number that behaves like a button.
I did some method swizzling to see where this popover comes from, and it looks like it is generated before the openURL: method in UIApplication.
Digging further, it looks like the popover comes from some private objects in UITextView.
I think you'll have to reimplement.
Did you try it with some forward slashes?
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"tel://5555555"]];
Possibly related to this.
Use telprompt://5555555 instead of tel:5555555
I am using UIWebView to show some data.
UIWebView is detecting phone numbers, which is fine, but when the user clicks on the phone number it is trying to fire a call directly.
Is there any way I can show an confirm message after a user clicks on a phone number, to allow the user to confirm they would like to place a call to this number?
Did you try to putting a breakpoint in shouldStartLoadWithRequest delegate method of UIWebview ? You might be able to catch the event click there.
There is no part of UIWebView that allows you to know when a phone number has been clicked. You will either have to turn of phone number detection or detect phone numbers yourself and convert them to links manually, so will have control over what happens when you click them.