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

guydor

macrumors member
Original poster
Hi,

I've created an app that contains NSStatusItem when you click on, NSPopover is being shown.

My question is how can I determinate if the user clicks on the background, in this case I want to close the NSPopover.


Thanks!
 
Change the NSPopover's behavior property to NSPopoverBehaviorTransient.

NSPopoverBehaviorTransient

The system will close the popover when the user interacts with a user interface element outside the popover.

Note that interacting with menus or panels that become key only when needed will not cause a transient popover to close. The exact interactions that will cause transient popovers to close are not specified.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.