更改NSTableView备用行颜色 [英] Change NSTableView alternate row colors

查看:157
本文介绍了更改NSTableView备用行颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Interface Builder中的交替行选项在NSTableView上获取交替的行颜色。是否有任何方法可以更改交替行的颜色?

I'm using the "Alternating Rows" option in Interface Builder to get alternating row colors on an NSTableView. Is there any way to change the colors of the alternating rows?

推荐答案

找到更好的方法在这里。该方法覆盖NSTableView子类中的highlightSelectionInClipRect:方法,因此您可以为交替行使用任何所需的颜色。它不像使用NSColor类别一样简单,它只影响你选择的表视图。

Found a better way to do it here. That method overrides the highlightSelectionInClipRect: method in an NSTableView subclass so you can use any color you want for the alternating rows. It's not as hackish as using an NSColor category, and it only affects table views you choose.

这篇关于更改NSTableView备用行颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆