3 回答

TA貢獻1900條經驗 獲得超5個贊
在iOS 7上,您可以設置tintColor
的UITextView
。它會影響鏈接顏色以及光標線和所選文本的顏色。
iOS 7還向UITextView
調用添加了一個新屬性,linkTextAttributes
該屬性似乎可以讓您完全控制鏈接樣式。

TA貢獻1789條經驗 獲得超8個贊
我沒有使用UITextView,而是使用UIWebView并啟用了“自動檢測鏈接”。要更改鏈接顏色,只需為標簽創建常規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 關注
- 493 瀏覽
添加回答
舉報