0

I would like to change the background color of a highlighted link in UITextView. After inspection I found about this: when a link is tapped a UIHighlightView is created and positioned inside the UITextView under the link. I would like to detect this view and change its color. Is this allowed by AppStore rules?

dvkch
  • 1,079
  • 1
  • 12
  • 20

1 Answers1

0

It probably isn't allowed. You do have access to an alternative, though:

textView.linkTextAttributes = @{NSBackgroundColorAttributeName:[UIColor redColor]};
Ian MacDonald
  • 13,472
  • 2
  • 30
  • 51
  • unfortunately this does work, maybe because I use an attributed string already as text. the `NSForeground...` attribute works, but not background – dvkch Jan 29 '15 at 18:00
  • What if you assign a clear background to your whole string first? `[attribStr addAttribute:NSBackgroundColorAttributeName value:[UIColor clearColor] range:NSMakeRange(0, attribStr.length)];` – Ian MacDonald Jan 29 '15 at 18:04
  • I even tried using it with standard NSString and link detection, I can't get the background attribute to work. Can you help me with this? – dvkch Jan 29 '15 at 18:31