Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
654 views
in Technique[技术] by (71.8m points)

objective c - How to change NSTextField background color in NSPopOver

enter image description here

Mac OSX 10.10 Xcode 6.1

I created a tableview in NSPopOver. I try to change textfield's background color. Why? no effect. The tableview's highlight set to "regular". which way can let me change textfields background color to white?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

There's a known bug with text fields and the "vibrancy" blending added in Yosemite. It's known to affect popovers.

The workaround is to set the appearance property of the table view to NSAppearanceNameAqua.

This was confirmed by an Apple engineer in their devforums.

2019-05-09 EDIT:

This issue also sometimes affects NSTextFields that appear on popovers where the background is grey. Here's the Swift 5 fix, add this to the viewDidLoad() function of your popover controller

self.someTextField.appearance = NSAppearance.init(named: .aqua)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...