I currently have an NSStatusItem
for the status bar that is initialized in awakeFromNib
like this:
statusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:NSVariableStatusItemLength];
[statusItem setMenu:statusMenu];
[statusItem setImage:statusImage];
[statusItem setAlternateImage:statusHighlightedImage];
[statusItem setHighlightMode:YES];
[statusItem setTarget:self];
I have an NSMenu
that opens when the icon is clicked. One of the options, when clicked, is supposed to open an NSPopover
from the status bar icon. To do that, I have this code, which is connected to the menu item via Interface Builder:
- (IBAction)prefs:(id)sender {
NSRectEdge prefEdge = NSMaxYEdge;
[[self pop] showRelativeToRect:[[statusItem view] bounds]
ofView:[statusItem view]
preferredEdge:prefEdge];
}
However, when I click the menu item that should open the Popover, nothing happens. Is there any particular reason why this might be the case? As far as I can tell, it should be possible to do.
Thanks in advance. I looked through Stack Overflow the best I could, but if there's a true duplicate question, please link me to it.
FYI: The statusItem
variable is the NSStatusItem
.