I have a statusItem in the StatusBar. I’ve retained a reference to it in my class.
Now, I want to update the image of the item.
In order to this, I wrote a method similar to:
-(void)updateStatusIcon:(NSString *)newImage
{
[statusItem setImage:[NSImage imageNamed:newImage]];
}
The image is a valid icon and works when I set it initially so I know the image is fine.
When this code executes, the statusItem disappears from the StatusBar completely.
Any idea what the best way to update the image on a NSStatusItem is?
That’s the correct way to set the status item image. There’s a problem either with your image or somewhere else in your code.