Chr*_*fer 5 macos cocoa nstextview
我有一个NSTextView,使用该-setLinkTextAttributes:方法已为其设置了默认链接样式属性。这是我希望用于传出链接的样式。
在文本视图中,我还具有可触发区域,这些区域可触发文本视图内的功能。我已经将它们实现为链接。我希望这些样式的样式与传出链接无关。因此,编写代码的逻辑方法是这样的:
[attrStr addAttribute:NSLinkAttributeName
value:@"myapp://togglesomething"
range:hlRange];
[attrStr addAttribute:NSForegroundColorAttributeName
value:[NSColor yellowColor]
range:hlRange];
Run Code Online (Sandbox Code Playgroud)
但是链接的颜色不会更改为我在此处设置的颜色。
所以问题是: