swift - OS X Application Pop Up Menu -
i have custom image button. want display custom menu when clicked on it. using
settingmenu.popupmenupositioningitem(settingmenu.itematindex(0), atlocation: nsevent.mouselocation(), inview: nil )
i created menu , created outlet it. still not able see menu
any suggestions?
in appdelegate.swift:
let statusitem = nsstatusbar.systemstatusbar().statusitemwithlength(-2) if let button = statusitem.button { button.image = nsimage(named: "buttonimagehere") button.action = selector("actionforclickingbuttonhere:") } func actionforclickingbuttonhere(sender: anyobject) { //present view, show menu list, whatever }
if want hide dock icon in info.plist
:
for full example see this tutorial.
Comments
Post a Comment