NSTableView 消除分隔列的空白
我有一个包含 4 列的 NSTableView。我还为每行设置了自定义背景颜色。唯一的问题是我有这些丑陋的白色空间,网格线将在水平轴和垂直轴上移动。我在IB中都没有勾选,但它们仍然出现。如何去掉垂直的并更改水平的颜色和大小?
这是我所看到的: 替代文本 http://img815.imageshack.us/img815/9030/homex.png
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
要摆脱垂直空间但保留水平空间:
请参阅 Apple 文档 了解更多详细信息。
To get rid of vertical spaces but keep the horizontal ones:
See Apple documentation for more details.
您需要重写 drawClipInRect 来绘制你自己的网格。我链接到的文章对其进行了修改,使其仅绘制垂直网格线。您必须将其修改为仅绘制水平线,但基本策略是相同的:通过覆盖它,您可以通过简单地不包含其代码来使其不绘制垂直线。
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.