I am creating a small state application when I click on the icon that displays NSPopover. Everything worked fine until I switched to El Capitan. The problem is that when I first start the application, I mimic the status bar icon automatically because I want to see a popover and it appears in the lower left corner of the screen. After I close it and open it again, it appears at the top of the screen. Do you see something wrong? This is the code, and when I print the values ββin showPopover, there is nothing wrong
private let menu = MenuBarController() override init() { super.init() self.menu.onMouseDown = { if (self.menu.iconView?.isSelected == true) { self.showPopover() } else { self.hidePopover() } } } func showPopover() { let icon = self.menu.iconView! let edge = NSRectEdge.MinY let rect = icon.frame self.popover?.showRelativeToRect(rect, ofView: icon, preferredEdge: edge); } func applicationDidFinishLaunching(aNotification: NSNotification) { let icon = self.menu.iconView! icon.mouseDown(NSEvent()) }
Also, if I simulate an icon, click after a short delay.
source share