Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

change uitextview hyperlink color [duplicate]

Tags:

ios

uitextview

I am using UITextView and i want to change the color of hyperlink which i use in this component. For example if UITextView is showing www.gmail.com then it shows up in blue color. I want to change that color.

like image 877
Muzamil Hassan Avatar asked Nov 15 '12 20:11

Muzamil Hassan


People also ask

How do I recolor a Hyperlink?

Change the color of a hyperlink Select the hyperlink you want to re-color. (How do I insert a hyperlink?) On the Home tab of the ribbon, select the Font Color arrow to open the menu of colors. Select the color you want for the hyperlink.

How do I change the color of a link in TextView Swift?

You can Change the Hyperlink Color in a TextView by the following: In the Nib file, you can go to the Properties Window and change the Tint to which ever color you want to.

How do I change the color of a Hyperlink in Sharepoint?

Click Page Design, and then click the More arrow next to the Schemes gallery. Click Create New Color Scheme. In the Create New Color Scheme dialog box, under New, click the arrow next Main to change the body text color or Hyperlink to change the color of the hyperlink text.


1 Answers

Huzzah! Apple have released a proper solution with iOS7! As explained in this answer you can use the linkTextAttributes property of a UITextView. A white, underlined link would look something like this:

yourTextView.linkTextAttributes = @{     NSForegroundColorAttributeName: [UIColor whiteColor],      NSUnderlineStyleAttributeName: [NSNumber numberWithInt:NSUnderlineStyleSingle] }; 

or alternatively you could change the tintColor, since UITextView inherits from UIView and uses the tintColor property to colour links - see:

yourTextView.tintColor = [UIColor whiteColor]; 

Now your links can look epic!

like image 153
Tim Windsor Brown Avatar answered Oct 04 '22 12:10

Tim Windsor Brown