开发者

UItextView detection turnoff highlight for links, phone numbers etc

I have a UITextView which contains a phone number, email address and web url. I can get the detection to work which is fine however I dont want it to change the colour of the text items to blue w开发者_Go百科ith underline I just want it to look normal but when you click it it does what its supposed to do. So basically white text with detection but without changing the appearance of the detected item.


Did you try textView.dataDetectorTypes = UIDataDetectorTypeNone;?

For more data detector types see this UIKit Data Types Reference.


I don't know of any way of achieving that using a regular UITextView.

However, you could use a UIWebView with dataDetectors = UIDataDetectorTypeAll; (or whichever configuration you need). You would also need to generate the HTML (preferably in your app) and use CSS styles to render links however you want. For example:

<style type="text/css">
  a:link {
    text-decoration: none; color:white;
  }
</style>

Might seem a little quirky... but it's worth a shot! (I haven't tested this in practice, please let me know if it works.. Thanks).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜