如何以编程方式更改iOS中超链接的默认颜色?
我想更改 UITextView 内的超链接颜色。默认颜色为蓝色,文本上带有下划线。 (我正在对电话号码/地址/电子邮件进行数据类型检测)有没有办法改变颜色?请告诉我。
谢谢。
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.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
更改内置
UITextView
的行为是一项非常棘手的任务,几乎不可能。dataDetectorTypes
文档:我认为这不是您正在寻找的行为..(点击链接总是会打开应用程序)-这也会违背 HIG。
我建议您看看以下问题:
我可以更改自动检测到的链接的颜色吗UITextView?
It is a pretty tricky task to almost impossible to change the behavior of the built in
UITextView
.dataDetectorTypes
docs: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?