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.
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.
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!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With