PDA

View Full Version : Making a phone # clickable?




nottooshabby
Feb 19, 2009, 10:25 PM
So I know how to use openurl to make a button call a phone number or send an email, but is there a way to have a label that is a phone number be the button itself or be clickable? Do I need to make a custom invisible button behind the label that calls an ibaction function that contains the openurl command or is their a way to make the phone number look like a hyperlink so that the user would know they could click it to call the phone number? Hopefully this makes sense...



bbrosemer
Feb 19, 2009, 11:46 PM
So I know how to use openurl to make a button call a phone number or send an email, but is there a way to have a label that is a phone number be the button itself or be clickable? Do I need to make a custom invisible button behind the label that calls an ibaction function that contains the openurl command or is their a way to make the phone number look like a hyperlink so that the user would know they could click it to call the phone number? Hopefully this makes sense...

I am pretty sure it has to be a button ...

firewood
Feb 20, 2009, 12:08 AM
You could try sticking the number inside a UIWebView as an HTML link.

drivefast
Feb 21, 2009, 11:49 AM
you may have already found the answer by now, but if you didnt. you can either ( a ) use your label like you use an UIView to handle touch events: UILabel inherits from UIView, as an effect you have all the UIView methods available or ( b ) use a button of type "custom", set the "title" property to whatever you wanted the label to say, and use the font properties to adjust color and underlining.

nottooshabby
Feb 21, 2009, 06:05 PM
you may have already found the answer by now, but if you didnt. you can either ( a ) use your label like you use an UIView to handle touch events: UILabel inherits from UIView, as an effect you have all the UIView methods available or ( b ) use a button of type "custom", set the "title" property to whatever you wanted the label to say, and use the font properties to adjust color and underlining.

Good call. I hadn't thought about (b). Thanks.... That should be easy enough.

PhoneyDeveloper
Feb 22, 2009, 10:54 AM
How do you adjust underlining with fonts? Is there a font on the iPhone that supports underlining?