0

I'm using WKWebView to load local txt file. After load succ, long press tap on text, text selection and UIMenuController will appear. The color of text selection rect is default(blue), how can I change it?

I have used code blow but it doesn't work.

webView.tintColor = .red

Any help would be appreciated.

desmond_yy
  • 83
  • 6
  • 1
    Possible duplicate of [How to change the text selection color in WKWebView?](https://stackoverflow.com/questions/45437193/how-to-change-the-text-selection-color-in-wkwebview) – Tamás Sengel Mar 28 '19 at 15:49
  • @Tamás Sengel Thanks.But I'm not loading html file, I load local txt file, I can't add javascript code. – desmond_yy Mar 29 '19 at 01:15
  • You can call [`evaluateJavaScript`](https://developer.apple.com/documentation/webkit/wkwebview/1415017-evaluatejavascript) regardless of the source. – Tamás Sengel Mar 29 '19 at 02:13
  • @Tamás Sengel But how can I add function highlight(colour) to my local .txt file?Many thanks! – desmond_yy Mar 29 '19 at 02:29

0 Answers0