Making a phone call

Hi everyone,
I have been struggling with this what seems to be a simple job. I have a tableview that list names and addresses I would like to be able to tap on the name in the tableview and have it pop up and ask to make the call as in the picture.IMG_0788
Can you tell me what I should be using to make this happen?

Thanks
Drew

Hi @drewgost, if you are using a UITextView you can set it to detect a phone number. One way could be programtically such as
myUITextView.dataDetectorTypes = .phoneNumber. With interface builder you can tap on the UITextView, select attributes inspector, then select the option under data detectors. You also have to make sure the isEditable property is set to false.
Reference to dataDetectorTypes - Apple Developer Documentation

Thank you gdelarosa, I am not using a UITextView unfortunately. I am using a tableView with labels that are populated from another view controller.
I will look for another way to populate the phone number.
Thanks again for your time.

@drewgost Do you still have issues with this?

Hi shogunkaramazov,

Yes, I can’t get the call function to work when I tap on the number in the tableView. I have tried different versions of making the phone call but none do what I expect.

This topic was automatically closed after 166 days. New replies are no longer allowed.