如何调出iPhone通话屏幕 [英] How can i bring up the iPhone call screen

查看:127
本文介绍了如何调出iPhone通话屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我允许我的用户在我的应用程序中选择电话号码。然后,如何启动iPhone通话屏幕然后如果可能,拨打电话?

I allow my user to select phone numbers in my application. How can I then bring up the iPhone call screen and then if possible, initiate the phone call?

推荐答案

你必须在您的应用程序中重新创建拨号屏幕(对我来说不需要太长时间。)输入电话号码后,您需要通过以下方式拨打电话:

You'll have to recreate the dial screen within your application (didn't take too long for me to do.) Once you have the phone number entered, you'll need to initiate the phone call by doing:

NSString* theNumberYouGathered = @"9994441234";
[[UIApplication sharedApplication] openURL: [NSURL URLWithString: [NSString stringWithFormatting: @"tel:%s", theNumberYouGathered]]];

请注意,这只适用于实际的手机,而不适用于模拟器。

Note this will only work on the actual phone, and not the simulator.

要创建拨号器屏幕,您需要:

To create the dialer screen you'll need to:


  • 创建一个带有一组的xib文件 UIButton s(#1-9), UILabel 显示当前输入的号码和呼叫 按钮。

  • 在数字 UIButton 上连接按下并将数字添加到本地变量 ViewController上的NSString 。用这个号码更新 UILabel

  • 当按下 UIButton 的电话时,取本地存储的#并用上面的方法调用。

  • Create a xib file with a set of UIButtons (for #s 1-9), a UILabel to show the currently entered number, and a "Call" button.
  • Hook up the presses on the number UIButtons and add the digit to a local variable NSString on your ViewController. Update the UILabel with this number.
  • When the call UIButton is pressed, take the locally stored # and place the aforementioned method call with it.

这篇关于如何调出iPhone通话屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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