xcode - How to invert text colour of selected NSTableView row -
i have nstableview in i'm changing colour of text in particular column, when row selected, text not change more appropriate colour it's readable.
finder's date modified, size, , kind columns have grey text, , when select file/folder row, grey text changes white (so it's readable within blue highlight).
i can't find magic checkbox on xcode enable behaviour default, know how might achieve same effect?
i'm using swift in xcode 6.3.
thanks.
you don't view or view hierarchy you're using cells. don't how or you're setting text fields' color or color, specifically.
when row selected, row automatically computes interiorbackgroundstyle. sets backgroundstyle of cell view if responds -setbackgroundstyle: or nscontrol cell responds that.
if cell view instance of nstablecellview, forwards background style of subviews meet same criteria. if use different container view cell view , want background style forwarded along this, have implement in view class.
an nstextfield's cell (an nstextfieldcell) responds -setbackgroundstyle: , has background style set automatically above mechanisms. text field cell automatically change text color white if textcolor 1 of standard control colors (e.g. nscolor.controltextcolor()), won't if assign non-standard color. so, if you're setting specific color text, responsible changing when background style changes.
you can use subclass of nstablecellview , add property observer (didset) backgroundstyle property. can change text field's textcolor depending on style set. example, can use custom color if background style not .dark or use normal text field color nscolor.controltextcolor() if .dark (so text field display white).
you use subclass of nstextfieldcell text field , same sort of thing. or override drawinteriorwithframe(_:inview:) draw different text color depending on background style.
Comments
Post a Comment