NSTableView get rid blank space separating columns

主宰稳场 提交于 2019-12-08 21:11:04

问题


I have an NSTableView with 4 columns. I also have a custom background color for each row. The only problem is I have these ugly white spaces where the gridlines would go in both the horizontal and vertical axis. I have both unchecked in IB, but they still show up. How can I get rid of the vertical ones and change the color and size of the horizontal ones?

Here's what I see: alt text http://img815.imageshack.us/img815/9030/homex.png


回答1:


To get rid of vertical spaces but keep the horizontal ones:

[yourTableView setIntercellSpacing:NSMakeSize(0.0, 2.0)];

See Apple documentation for more details.




回答2:


You'll need to override drawClipInRect to draw your own grid. The article I linked to modifies it so it only draws vertical gridlines. You'll have to modify it to only draw horizontal ones instead, but the basic strategy is the same: By overriding it, you can make it not draw vertical lines by simply not including the code for it.



来源:https://stackoverflow.com/questions/3032802/nstableview-get-rid-blank-space-separating-columns

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!