Reputation: 51
I put into a non editable UITextView
only one URL as string in order to make a link that work great until iOS8.3
, set is :
myTextView.text = aLink;
First set is ok nice and link work well when touch, but another set will failed, text
is ok with the new url text, link is well detected with blue color but touch will always responds with first url as if UITextView
be not uptaded.
Does I have to set another thing into UITextView
?
Upvotes: 1
Views: 513
Reputation: 51
One solution:
Just after setting new string (with a link) I remove detection property:
self.myTextView.dataDetectorTypes = UIDataDetectorTypeNone;
and trig after 0.1 second a new setting as:
self.myTextView.dataDetectorTypes = UIDataDetectorTypeLink;
Works fine.
Upvotes: 2
Reputation: 16298
I found a slightly alternative way that seems to fix it in my case. It avoids using a timer so the fix seems instant.
self.textviewText.dataDetectorTypes = UIDataDetectorTypes.init(rawValue: 0)
self.textviewText.text = newstring
self.textviewText.dataDetectorTypes = .link
Upvotes: 0