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.
Asked
Active
Viewed 7.0k times
28

Vadim Kotov
- 8,084
- 8
- 48
- 62

Sam
- 799
- 2
- 8
- 14
-
@esqew close enough for me... why ppl cant search is beyond me – Daij-Djan Mar 17 '13 at 14:45
2 Answers
90
Try this out in your button action
-(IBAction)callPhone:(id)sender {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://1115550123"]];
}
Then in Interface Builder you should connect the TouchUpInside
event to the previously declared action (callPhone:
) and you are done.
-
-
-
1@arclight And then, when the user finishes the call? the app doesn't return, when you finish the call the phone shows your contacts. how can I do for the app come back after the end of the call? – Mar 15 '13 at 22:48
-
-
-
-
38
You can also go back to your original app when finish the call just by using this one instead:
-(IBAction)callPhone:(id)sender {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"telprompt://2135554321"]];
}
Enjoy!

ytpm
- 4,962
- 6
- 56
- 113
-
-
@Yossi Is it possible to add here some custom message without using UIAlertView written by myself? – andilabs Feb 02 '14 at 01:32
-
-
-
-
So for example, you can open ```MFMessageComposeViewController``` and send an email to more than one contact at once. So can you pass more than one phone number to the phone app and have a conference call? – Supertecnoboff May 18 '15 at 11:14