I feel like I'm missing something easy but I can't seem to find out how to do this:
I set the attribute to a link like so:
[myAttrString addAttribute:NSLinkAttributeName value:linkURL range:selectedRange];
That works but the link is blue and I can't seem to change the color. This sets everything except the link to white:
[myAttrString addAttribute:NSForegroundColorAttributeName value:[UIColor whiteColor] range:selectedRange];
Is there another color attribute name that I can't seem to find that is specific to links?
UITextView
Set the UITextView
's linkTextAttributes
like so:
textView.linkTextAttributes = @{NSForegroundColorAttributeName:[UIColor whiteColor]};
I actually ended up using TTTAttributedLabel for my label and then was able to do the following which worked perfectly:
NSDictionary *linkAttributes = @{(id)kCTForegroundColorAttributeName: [UIColor whiteColor], (id)kCTUnderlineStyleAttributeName: [NSNumber numberWithInt:kCTUnderlineStyleSingle] }; self.lblDescription.linkAttributes = linkAttributes;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With