问题
I have an NSTextField
that contains an NSAttributedString
which itself contains a clickable link.
I've change the colour of the link for my own styling, however when I click on it it becomes blue and underlined. How can I stop this?
回答1:
Seems that I'm not the only one with this problem, and there's a handy class to solve it:
https://github.com/laevandus/NSTextFieldHyperlinks
回答2:
This (http://developer.apple.com/library/mac/#qa/qa1487/_index.html
) may help you. It will show you how to set/change the blue link color and the underlineAttribute. You may also have a look at the methods -linkTextAttributes
and -setLinkTextAttributes:
of an NSTextView.
来源:https://stackoverflow.com/questions/14366054/nstextfield-clicked-link-colour