NSPopover - Hide when focus lost? (clicked outside of popover)

前端 未结 2 1653
小鲜肉
小鲜肉 2021-02-13 01:14

I\'m using the doubleClickAction of a NSTableView to display a NSPopover. Something like this:

NSInteger selectedRow = [da         


        
2条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-13 01:49

    You need to change the property behavior of your popover (in code or on interface builder) to:

    popover.behavior = NSPopover.Behavior.transient;
    

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

    Read more about this in Apple's documentation.

提交回复
热议问题