基于视图的NSTableView的更改选择的颜色 -
来源:互联网 发布:网络博客娱乐平台出租 编辑:程序博客网 时间:2024/05/16 17:07
Standard highlighting color in OS X applications is blue.在OS X应用程序的标准突出显示颜色是蓝色的。
Is it possible to change it to another color, eg gray?是否有可能将其更改为另一种颜色,如灰色?
Note that I am using the new view-based NSTableView
available starting from OS X 10.7.请注意,我使用新的基于视图的NSTableView
从OS X 10.7。
You have to subclass
NSTableView
, and rewrite the functions below in order to change the alternating colors.您必须NSTableView
子类,并改写了以下功能以改变交替的颜色。(void) drawRow: (NSInteger) row clipRect: (NSRect) clipRect
(void) drawBackgroundInClipRect: (NSRect) clipRect
** This one to change the main and alternate color **(void) drawBackgroundInClipRect: (NSRect) clipRect
**这一个改变的主力和替补的颜色**
Use a for loop and insert this conditional
(i % 2 == 0)
to detect odd and even rows.使用for循环,并插入此条件(i % 2 == 0)
来检测奇数行和偶数行。It seems to me there is an option available to change this coz the documentation says three selection style and the default style in regular is blue, look at the image below..在我看来,有一个选项可以改变这个堂妹的文件说,三个选择的风格和默认样式经常是蓝色的,看下面的图片...... you need to send it a message which I cant figure out as I have never developed apps for mac before..你需要向它发送一个消息,我无法弄清楚,因为我从来没有开发适用于Mac的应用程序之前.. hoping this helps...!希望这会有所帮助...!
- 基于视图的NSTableView的更改选择的颜色 -
- 基于cell-base的NSTableView
- 基于cell-base的NSTableView
- 基于cell-base的NSTableView
- NSTableView的使用例子
- NSTableView的使用例子
- NSTableView中设置selectedRow的高亮颜色
- NSTableView中设置selectedRow的高亮颜色
- 基于cell base的NSTableView的简单实现
- UITabbarController更改点击的图片与文字颜色以及更改tabbar的视图颜色
- 【Mac OS X开发】在NSAlert中添加NSTableView,双击NSTableView单元格用于确定选择的效果
- NSTableView行的拖拽
- NSTableView的背景色设置
- NSArrayController绑定NSTableView的方法
- checkbox 颜色的更改
- 基于base - cell的NSTableView,学习苹果的demo AnimateTableView所写
- 更改子窗体的颜色
- 更改手机窗口的颜色
- 单例模式中,饿汉式和懒汉式有什么区别?各适合用在哪里?为什么说推荐用饿汉模式?
- TCP_NODELAY详解
- 第十七天dbutils的使用------Commons DbUtils(Apache)第三方的:只是对JDBC编码进行了简单的封装
- FusionCharts导出图表常见问题(FAQ)汇总---FusionCharts常见问题大全
- Hardcoded string,should use @string resource警告 && eclipse中一次性导入用到的类 && 重命名多处调用的对象
- 基于视图的NSTableView的更改选择的颜色 -
- What is PHP Composer
- Leetcode: Text Justification
- Android国际化资源文件自动化生成工具
- FusionCharts生成Flash图表常见问题FAQ
- 归一化图像
- IOS-录音功能
- Singleton模式
- 让你无处逃逸—无线定位技术简介
Since you're using the view based NSTableView, you can subclass NSTableRowView, feed it to the table delegate method
- (NSTableRowView *)tableView:(NSTableView *)tableView rowViewForRow:(NSInteger)row;
, then customize your selection in the row view class.由于您使用的浏览NSTableView的,你也可以继承NSTableRowView,将它输入到表中的委托方法- (NSTableRowView *)tableView:(NSTableView *)tableView rowViewForRow:(NSInteger)row;
,然后定制选项行中的视图类。Here's an example:下面是一个例子: