Created
May 13, 2013 09:18
-
-
Save maxsteenbergen/5567139 to your computer and use it in GitHub Desktop.
This should draw an icon in the Status Bar. It works on my MacBook, but on my iMac it doesn't show an icon. The menulet is there, I can click it: it simply doesn't show the icon.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)drawRect:(NSRect)rect | |
{ | |
/* NSImage *img = [NSImage imageNamed:@"[email protected]"]; | |
rect = CGRectInset(rect, 2, 3); | |
NSRect imageRect; | |
imageRect.origin = NSZeroPoint; | |
imageRect.size = [img size]; | |
[img drawInRect:rect fromRect:imageRect operation:NSCompositeSourceOver fraction:1]; | |
*/ | |
NSImage *img = [NSImage imageNamed:@"basket.png"]; | |
NSStatusItem *statusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:NSVariableStatusItemLength]; | |
[statusItem setImage:img]; | |
[statusItem setHighlightMode:YES]; | |
[statusItem setEnabled:YES]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I may be wrong, but I seem to remember that you need too keep a reference to the
statusItem
for it to stay visible... Perhaps stick it into an ivar?