New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Link colors are not set #792
Comments
Seems that in my case, there was the attribute "CTForegroundColorFromContext" set to 1. Removing that attribute by using
did the trick. Now the link colors are visible. |
Same issue and same trick worked for me |
You are welcome to provide a fix. IIRC the |
I'm having a similar issue but removing the
Here's the code:
I really appreciate any help. Thanks! |
@bmunge where are you trying to use such an attributed string? I found that UILabel forces the color to blue and underlined. You have to do the drawing yourself with NSLayoutManager if you want those to be different. |
Ah yes, I am using it in an UILabel. I was able to get it working by removing the NSLink attribute. It seems that as long as the NSLink attribute is in the dictionary, the UILabel will use the default link styling. Thanks for the quick response. I'm not sure that this is ideal but since I'm using a tap gesture recognizer to trigger the "link" I was able to get away with removing that attribute. |
This was helpful, fortunately a quick Google search of CTForegroundColorFromContext returned 4 results and this was the first :p. CTForegroundColorFromContext causes odd behaviour in conjunction with TTTAttributedLabel and will result in text selection and sizing settings to be ignored. Hopefully this can serve to help someone else. Thanks a lot @georgschuster! |
@bmunge @nin9tyfour Were you able to figure this out? I'm also not able to get the color to show up for TTTAttributedLabel even when removing CTForegroundColorFromContext. |
@cerupcat I'm not too sure, removal of CTForegroundColorFromContext immediately restored all of the attributes in my case. |
@cerupcat did you try to set your tintColor? |
Weird. I had to remove
I would expect the attributed string to be already formatted when i set the option |
@cerupcat After removing the CTForegroundColourFromContext, you need to set the following on your TTTAttributedLabel with the colour you're after, e.g
|
Since there has not being any activity on this issue in several months we are closing it for now. If you are interested in providing a fix or solution you are encouraged to provide a pull request. Please read the release notes for the latest 1.6.20 release. If you still require assistance, you can hire me to work on your issues for a reasonable fee. |
Hi,
I'm trying to use colors for links in an attributed string made of HTML.
A simplified version of what I'm doing is:
I can see the link in default color (black). While the DTDefaultLinkDecoration is working, the DTDefaultLinkColor shows no effect.
Also, setting the link color via the DTCSSStylesheet doesn't work. However, if i change the "a" to a "b", the bold text gets the right color.
It seems to me that no color operation on hrefs are working.
Am I missing somtehing obvious here?
The text was updated successfully, but these errors were encountered: