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

ios - Memory not freeing up after popping viewcontroller using ARC -

Django REST Framework perform_create: You cannot call `.save()` after accessing `serializer.data` -

Why does Go error when trying to marshal this JSON? -