在iOS中拨打按钮电话号码 [英] Making a Button Call a Phone Number in iOS
本文介绍了在iOS中拨打按钮电话号码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想创建一个按钮,当按下该按钮时,将拨打iPhone上的电话号码。我不知道这是否可行,但是如果是的话我会喜欢有人帮我这个。
我没有任何代码,所以有人需要从一开始就帮助我完成。
I want to create a button that, when pressed, will call a phone number on the iPhone. I don't know if this is possible, but if it is I'd love for someone to help me with this.
I dont have any code for it, so someone would need to help me from start to finish.
推荐答案
在按钮操作中试试这个
-(IBAction)callPhone:(id)sender {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://1115550123"]];
}
然后在Interface Builder中你应该连接 TouchUpInside
先前声明的操作( callPhone:
)的事件已经完成。
Then in Interface Builder you should connect the TouchUpInside
event to the previously declared action (callPhone:
) and you are done.
这篇关于在iOS中拨打按钮电话号码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文