简体   繁体   中英

How to jump to dial pad in iOS

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM