开发者

setBackgroundStyle on NSTextField with an Attributed String Value not working

开发者 https://www.devze.com 2023-03-23 22:13 出处:网络
OS X 10.7: Whenever I try to setBackgroundStyle: on an NSTex开发者_StackOverflowtField\'s cell that has an Attributed String value, the background style is unmodified. If the NSTextField has just a S

OS X 10.7:

Whenever I try to setBackgroundStyle: on an NSTex开发者_StackOverflowtField's cell that has an Attributed String value, the background style is unmodified. If the NSTextField has just a String value, the background style setter works.

[myTextField cell] returns an object of type NSTextFieldCell in both cases, which inherits setBackgroundStyle: from NSCell.

Anyone have a suggestion on how I can get around this limitation? I know I could try to recreate it with attributes, but I may never be able to get it just right.

P.S. - NSBackgroundStyleLowered appears to override your cell's text color (makes mine white), whereas NSBackgroundStyleRaised does not.


IME, the NSAttributedString overrides the settings for the NSTextField.

0

精彩评论

暂无评论...
验证码 换一张
取 消