I recently noticed this question about different-colored spinning progress indicators on Stack Overflow, and finally got around to giving my answer. I’m not sure if the original question was answered satisfactorily by using a UIActivityIndicatorView, but I hope my code can be useful to someone.

I have implemented two different clones of the spinning NSProgressIndicator, which can be drawn at any size and in any color. One is a subclass of NSView, and can be used on OS X 10.4, and the other is a subclass of CALayer, and can be used in a CoreAnimation-based project on OS X 10.5, and presumably on an iPhone (though I haven’t actually tested that yet).

I put the code up on github (both the NSView-based version and the CoreAnimation-based one), under the BSD license. They each include the spinning progress indicator classes and an example app showing how they can be used. The code should be pretty straight-forward. One caveat is that they might not be super fast performance-wise, but should be good for most uses.

Here are some screenshots:

NSView-based version:

Note: The background can also be transparent.

CoreAnimation-based version:

Note: The background here is a QuartzComposer animation, just for fun.

Please let me know if you have any questions, comments, or if you find this code useful. Thanks!