4thSpace
4thSpace

Reputation: 44312

Why does UIWebView keep detecting phone numbers?

I have a UIWebView with detect phone numbers unchecked. However, it keeps underlining the numbers in this text:

Version: 2.1 3.19.2009

The text isn't in an anchor or anything. Is there a way to force the UIWebView to not detect phone numbers?

Upvotes: 7

Views: 8075

Answers (4)

Mobile Dan
Mobile Dan

Reputation: 7114

Swift 3+ programmatically

webView.dataDetectorTypes = []

Upvotes: 7

Suresh Varma
Suresh Varma

Reputation: 9740

Try

webview.dataDetectorTypes = UIDataDetectorTypeNone;

Upvotes: 18

iPhone developer.
iPhone developer.

Reputation: 2132

[webview setDetectsPhoneNumbers:NO];

It will work for you.....

Upvotes: 1

Sean Patrick Murphy
Sean Patrick Murphy

Reputation: 2761

It looks like there is a problem with Interface Builder's UIWebView attributes palette; the "Detects Phone Numbers" checkbox does not seem to have any affect. Examining the UIWebView's detectsPhoneNumbers property at runtime shows that it was not actually modified by IB.

For now, setting the detectsPhoneNumbers property in code to "NO" will work fine. The problem is only with the IB palette.

Unless we're both missing something, this is a bug. I'd suggest filing it at http://bugreport.apple.com/. Additionally, you can post it at http://openradar.appspot.com/ if you'd like to make it visible to other developers.

Upvotes: 11

Related Questions