且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在NSTabView中更改选项卡按钮和视图本身的颜色?

更新时间:2023-01-05 09:58:29

几个小时后,我认为您无法使用NSTabView完成它. 该文档说您不能再这样做了,NSTabView会尊重操作系统选择的主题.

After a couple of hours, I think you can't do it with NSTabView. The documentation says you can no longer do it and NSTabView will respect the theme chosen by the OS instead.

这使我想到了如何绘制自己的NSTabView标签?,我相信您已经看到了.但是,尽管有文档说明,SetImage/ForSegment对我却不起作用.

This led me to How to draw your own NSTabView tabs?, which I'm sure you've seen. But despite the documentation, SetImage/ForSegment did not work for me.

[ NSSegmentedControl颜色似乎找到了一种解决方案,并且SMSegmentView 是另一个.这两种解决方案都是较新的.

[NSSegmentedControl Colors seems to have found one solution, and SMSegmentView is another, although there may be licensing issues. Both these solutions are more recent.

我希望以上内容对您有帮助,祝您好运.

I hope the above will prove useful to you and good luck.