How to use the status indicator as an image for NSStatusItem?

I have an application that is NSStatusItem.

It has several different modes, each of which requires the start of an external process, during which the icon just lights up and appears frozen.

I want to use a method -setImage:(or sensible facsimile) to display something in the "spinner" strings commonly seen in web applications and throughout OS X.

Is there any built-in method for this (for example, some kind of instance NSProgressIndicator?) Or do I need to manually display the animation by looping through the images?

In any case, how would you implement it?

+3
source share
1 answer

For it to be animated (and not just a static image), you probably need to use -setView:and provide it with a custom view (which is then animated). You may be able to avoid using the standard standard NSProgressIndicator(i.e. Set Style NSProgressIndicatorSpinningStyle, etc.) as a "custom view".

But if the standard sizes of the NSProgressIndicator do not work, you can check out my YRKSpinningProgressIndicator (BSD license), which is a clone of the rotating NSProgressIndicator that can be set to any size and color.

+4
source

All Articles