I would like to have an attributed string in a NSTextView. The attributed string has 3 lines, each one a different color and no underline. I want to be able to click (or double click) on each line, which would print out the line number.
I would like to have an attributed string in a NSTextView . The attributed
Share
You can use the addAttribute:value:range of NSMutableAttributeString to assign the click behaviour to your attributed string.
According to the documentation : Attributed String. When your string is clicked, it should call clickedOnLink:atIndex: of TextView class or textView:clickedOnLink:atIndex: in the TextView Delegate.
Like this (coded on the browser, beware of errors )