Making a Button Call a Phone Number in iOS

Sam picture Sam · May 23, 2011 · Viewed 69.4k times · Source

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.

Answer

arclight picture arclight · May 23, 2011

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.