views:

83

answers:

1

Hi.

I'm developing an app in which, among other things, the user can input a phone number. Later, while seeing the inputed information, I display the phone number in a UITextView which detects the phone number automatically.

In an iPhone, when the user presses the phone number, he is automatically asked if he wants to make a call. This happens without me having to do anything.

The problem is... what happens in iPod and iPad? What is the default behaviour? Is there a way to detect that he user pressed the phone number, and output a UIAlertView saying "Unavailable action" or something like that?

Alternativelly, is there a way to get that behaviour when the user presses "something" in the screen without default functions? For instance... the user presses a button and it automatically calls 911 (I will not call THAT number, it's just an example).

Thanks for the answer. I'm kind of affraid of the behaviours in devices in which I cannot test my app (I don't have iPod nor iPad).

+2  A: 

I do not think that it's possible to catch if UITextView does handle a click on an URL. On a device without the possibility to call someone the UITextView simply does nothing.

You can call numbers yourself simply by opening the respective URL, in your case this would be

[[UIApplication sharedApplication] openURL:
   [NSURL URLWithString:@"tel:0800-CALL-ME"]];

Check the class description of UIApplication for more info.

frenetisch applaudierend
Thanks a lot. Now I just need to choose whether it detects the phone automatically (not giving the warning) or in the way you describe (giving the warning, but not being underlined).
camilo
Just one more question... on iPod and iPad, the UITextView automatically underlines the phone numbers like in iPhone? Thanks a lot.
camilo