开发者

how to change the default color of hyperlink in iOS programmatically?

开发者 https://www.devze.com 2023-03-26 11:54 出处:网络
I want to change the hyperlink color inside UITextView. The default colour is blue with a underline on the text. (I am doing data type detection for phone numbers/addresses/emails) Is there a way to c

I want to change the hyperlink color inside UITextView. The default colour is blue with a underline on the text. (I am doing data type detection for phone numbers/addresses/emails) Is there a way to change the color ? Please let me know.

开发者_StackOverflowThanks.


It is a pretty tricky task to almost impossible to change the behavior of the built in UITextView.

dataDetectorTypes docs:

You can use this property to specify the types of data (phone numbers, http links, and so on) that should be automatically converted to clickable URLs in the text view. When clicked, the text view opens the application responsible for handling the URL type and passes it the URL.

And I don't think that's the behavior you're looking for.. (tapping the link will always open the app) - this would also go against the HIG.

I would recomment you to have a look at the following question: Can I change the color of auto detected links on UITextView?

0

精彩评论

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

关注公众号