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

问题描述

我在可可应用程式中使用「spinner」NSProgressIndicator:





我想以不同的颜色显示它,以便它在黑暗的背景下显示得很好: p>



我该怎么做呢?我最后的办法是编写自己的自定义NSView子类,呈现自定义动画,但我甚至不知道从哪里开始。

解决方案

我实际上已经实现了可能适合您的需求的旋转NSProgressIndicator的克隆。它们可以以任何大小和任何颜色绘制。一个是NSView的子类,可以在OS X 10.4上使用,另一个是CALayer的子类,可以在基于CoreAnimation的项目中使用。代码位于github上(包括版本和),还有一个 in my blog。


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:

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.

解决方案

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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 03:14