I have an NSStatusItem with a custom view (TimeView) set but this blocks the click from displaying the NSMenu associated with the NSStatusItem
. If I disable the view for the NSStatusItem
then the menu shows correctly, however, if I enable it then nothing happens when I click on the view.
class AppDelegate: NSObject, NSApplicationDelegate {
@IBOutlet weak var statusMenu: NSMenu!
let statusItem = NSStatusBar.systemStatusBar().statusItemWithLength(NSVariableStatusItemLength)
func applicationDidFinishLaunching(aNotification: NSNotification) {
statusItem.view = TimeView(statusItem: statusItem)//Commenting out this line provides the correct functionality for displaying the menu
statusItem.menu = statusMenu
}
func applicationWillTerminate(aNotification: NSNotification) {
// Insert code here to tear down your application
}
}
Many thanks, Ben