简体   繁体   English

如何跳转到iOS中的拨号盘

[英]How to jump to dial pad in iOS

To make a phone call, use [[UIApplication sharedApplication] openURL:@"tel://"] it's very easy. 要拨打电话,请使用[[UIApplication sharedApplication] openURL:@"tel://"]这很容易。

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. iPhone SDK不允许您从应用程序拨打号码。 But you can do it by using a UITextField . 但是你可以使用UITextField Set keyboard type to UIKeyboardTypePhonePad 将键盘类型设置为UIKeyboardTypePhonePad

textfield.keyboardType = UIKeyboardTypePhonePad;

and set that number to textfield , 并将该数字设置为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]]];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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