I would like to provide the functionality whereby a user can dial a phone number by开发者_JS百科 tapping a button next to a label that shows the number. I have the basic button action method:
-(IBAction)Call:(id)sender{
//Define function
}
... but I don't understand how to trigger the dialing of the phone within the method.
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://18005551234"]];
Swift 2.0:
func phoneCallPromptAction() {
let url = NSURL(string: "telprompt://1111111111")
UIApplication.sharedApplication().openURL(url!)
}
to ask user if he want's to call the number or just:
func phoneCallAction() {
let url = NSURL(string: "tel://1111111111")
UIApplication.sharedApplication().openURL(url!)
}
to make a call from you app directly.
精彩评论