cocoa - customise main menu bar NSMenuItems -
how can customize main menu bar of os x app?
so far, have tried adding submenu menu item, want item perform func xyz when pressed, , have created nsmenuitem
class:
class itemclass: nsmenuitem { func xyz(){ //function code } }
then in attributes inspector menu item have assigned class itemclass. when run app menu item disabled despite fact enabled in attributes inspector.
any help?
you don't need subclass nsmenuitem so. nsmenuitem objects rely on responder chain. have set method in attributes inspector of first responder object this:
then need connect menuitem firstresponder , select method created. after that, follow answers instructions enable menu item.
Comments
Post a Comment