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:

attributed inspector menu item.

then need connect menuitem firstresponder , select method created. after that, follow answers instructions enable menu item.


Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -