用过滤器更改UITextView链接的颜色? [英] Change color of UITextView links with a filter?
问题描述
实际上有一种方法可以做到这一点使用私有API 。
$ b $ UITextView
有一个类(code> UIWebDocumentView $ c $选择 setUserStyleSheet:
。
以下代码应该将链接的颜色更改为绿色。至少,它为我工作! :)
$ b $ pre $ for(UIView * subview in textView.subviews){
[subview setUserStyleSheet:@a {color :#00FF00;}];
}
我知道这真的很晚,但是几个小时的Google让我没有在哪里,所以我想我会分享这个。
The detected links on a UITextView are always blue. There's no way to directly change this. But can I overlay some sort of filter which changes blue to, for instance, red?
There's actually a way to do this with private API.
A UITextView
has a (single) subview of class UIWebDocumentView
, with the selector setUserStyleSheet:
.
The following code should change the color of the links to green. At least, it worked for me! :)
for (UIView *subview in textView.subviews) {
[subview setUserStyleSheet:@"a { color: #00FF00; }"];
}
I know this is really late, but hours of Googling got me no where, so I thought I'd share this.
这篇关于用过滤器更改UITextView链接的颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!