NSTableView 消除分隔列的空白

发布于 2024-09-05 20:41:23 字数 281 浏览 10 评论 0原文

我有一个包含 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

寄居人 2024-09-12 20:41:23

要摆脱垂直空间但保留水平空间:

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

请参阅 Apple 文档 了解更多详细信息。

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

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

See Apple documentation for more details.

终陌 2024-09-12 20:41:23

您需要重写 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文