I'm creating a menulet application in Xcode 4, and I'm trying to figure out how to display a window that will appear when the menulet icon is clicked. I would hope for the window to be displayed as the normal NSWindow.
I have looked at the MAAttatchedWindow source code, and that doesn't seem to help me at all. Could someone please explain how to make a menulet drop-down a window when clicked?
I believe I'm supposed to use the setView: function to create a custom view for the NSStatusItem, but can't quite figure out how to code should be layed out. I have this so far:
-(void)awakeFromNib {
statusItem = [[[NSStatusBar systemStatusBar]
statusItemWithLength:NSVariableStatusItemLength]retain];
[statusItem setHighlightMode:YES];
[statusItem setTitle:[NSString stringWithFormat:@"%C", 0x24DC]];
[statusItem setEnabled:YES];
[statusItem setView:(NSView *)
how to I get the MAAttachedWindow to display as an NSView?
精彩评论