如何以不同的颜色显示旋转的 NSProgressIndicator? [英] How can I display the spinning NSProgressIndicator in a different color?

查看:21
本文介绍了如何以不同的颜色显示旋转的 NSProgressIndicator?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的可可应用程序中使用微调器"NSProgressIndicator:

I am using a "spinner" NSProgressIndicator in my cocoa app:

我想以不同的颜色显示它,以便它在深色背景上能很好地显示:

I would like to display it in a different color so that it will show up well on a dark background:

我该怎么做?我最后的手段是编写自己的自定义 NSView 子类来呈现自定义动画,但我什至不确定从哪里开始.任何帮助表示赞赏.

How would I go about doing this? My last resort would be to write my own custom NSView subclass that renders a custom animation, but I'm not even sure where to start on that front. Any help is appreciated.

推荐答案

我实际上已经实现了可能适合您需要的旋转 NSProgressIndicator 的克隆.它们可以以任何大小和任何颜色绘制.一个是NSView的子类,可以在OS X 10.4上使用,另一个是CALayer的子类,可以在基于CoreAnimation的项目中使用.代码在 github 上(基于 NSView 的版本和 CoreAnimation-based 版本),还有一个在我的博客上发布一些截图.

I actually have implemented clones of the spinning NSProgressIndicator that might suit your needs. They can be drawn at any size and in any color. One is a subclass of NSView, which can be used on OS X 10.4, and the other is a subclass of CALayer, which can be used in a CoreAnimation-based project. The code is on github (both the NSView-based version and the CoreAnimation-based version), and there is a post with some screenshots on my blog.

这篇关于如何以不同的颜色显示旋转的 NSProgressIndicator?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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