Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

AppleDev879

macrumors newbie
Original poster
Mar 1, 2011
23
0
I'm developing a simple menu bar app in which an icon in the menu bar should show an NSPopover. How can I get the popover to display based on the icon's position in the menubar?

The popular calendar app, Fantastical, is a good example of this behavior.

Thanks.
 
The trick seems be to set a custom view in the status item and use the custom view when sending showRelativeToRect:ofView:preferredEdge: to the NSPopover. But you'll need to custom draw the view and handle mouseDown in the view.
 
Note that NSPopover has some pretty serious issues with control focus when used from the menubar. Fantastical's popover is a custom version, I believe.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.