3 回答

TA貢獻(xiàn)1900條經(jīng)驗(yàn) 獲得超5個(gè)贊
在iOS 7上,您可以設(shè)置tintColor
的UITextView
。它會(huì)影響鏈接顏色以及光標(biāo)線(xiàn)和所選文本的顏色。
iOS 7還向UITextView
調(diào)用添加了一個(gè)新屬性,linkTextAttributes
該屬性似乎可以讓您完全控制鏈接樣式。

TA貢獻(xiàn)1789條經(jīng)驗(yàn) 獲得超8個(gè)贊
我沒(méi)有使用UITextView,而是使用UIWebView并啟用了“自動(dòng)檢測(cè)鏈接”。要更改鏈接顏色,只需為標(biāo)簽創(chuàng)建常規(guī)CSS。
我用了這樣的東西:
NSString * htmlString = [NSString stringWithFormat:@"<html><head><script> document.ontouchmove = function(event) { if (document.body.scrollHeight == document.body.clientHeight) event.preventDefault(); } </script><style type='text/css'>* { margin:0; padding:0; } p { color:black; font-family:Helvetica; font-size:14px; } a { color:#63B604; text-decoration:none; }</style></head><body><p>%@</p></body></html>", [update objectForKey:@"text"]];
webText.delegate = self;
[webText loadHTMLString:htmlString baseURL:nil];
- 3 回答
- 0 關(guān)注
- 491 瀏覽
添加回答
舉報(bào)