Take the tour ×

I need to show a phone number in a view and that when clicked a call is initiated. Currently I'm using an UILabel and I have no idea how to do it.

Is this the correct control? If no which one would be?

If it's the correct one, how can I do it?

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

An UILabel could be used (kind of showing a link) but an UIButton might be more appropriate.

You can find the code to initiate the code from this question (and answer).

Using a UIButton and the code from above would give you:

var btn = UIButton.FromType(UIButtonType.RoundedRect);
btn.Frame = new RectangleF (10,10,100,200);
btn.SetTitle ("call me", UIControlState.Normal); 
btn.TouchUpInside += delegate {
    UIApplication.SharedApplication.OpenUrl (NSUrl.FromString ("tel://411"));
share|improve this answer
The "911" is a brilliant number for testing purposes! :-) –  Krumelur Nov 17 '11 at 16:03
Good point ;-) 411 is more informative –  poupou Nov 17 '11 at 16:07
I prefer it to look like a link, like what you get when you send a SMS with a phone number, is there any other control outside UILabel that I can use? –  ignacio Nov 18 '11 at 15:31
Not sure I understand outside UILabel ? If you want something else then the example above use a UIButton, which you can customize (not to look so like a button). –  poupou Nov 19 '11 at 17:41
I got a solution, The best way is simply no using an UILabel but an UIButton with the "custom" mode (the first dropdown in the inspector @ interface builder) –  ignacio Nov 23 '11 at 18:54
add comment

Your Answer


