Reputation: 1449
Is there a way to change hyperlink color in situations when UITextView and, for example,
.dataDetectorTypes = UIDataDetectorTypePhoneNumber;
are used?
Thanks in advance!
Upvotes: 2
Views: 3739
Reputation: 18270
With iOS 7, you can change the hyperlink color using the linkTextAttributes
property of the UITextView
class.
For example:
aTextView.linkTextAttributes = @{NSForegroundColorAttributeName:[UIColor redColor]};
The above will result in the link displayed in red color.
Upvotes: 9
Reputation: 14164
I had this same issue. The best, easiest way to pull this off is the Nimbus library for attributed labels. You can color, add phone links, email links, the works. And it is much easier to use than the Three20 library that has it all as well.
Upvotes: 1
Reputation: 24994
Unfortunately, there is no way to do this with a UITextView
. The only way to have control over the hyperlink color would be to use a UIWebView
, where you could use CSS in a manner similar to this example.
Upvotes: 0