how to enable/disable NSToolbarItem

前端 未结 4 997
陌清茗
陌清茗 2021-01-04 13:39

I have a project that needs to disable/enable some NSToolbarItems depends on different options. I checked and found no parameter for this.

Is there a wa

4条回答
  •  别那么骄傲
    2021-01-04 14:15

    There is an easier solution :

    -(BOOL)validateToolbarItem:(NSToolbarItem *)toolbarItem
    {
    
        return [toolbarItem isEnabled] ;
    }
    

    that way you can use [yourToolBarItem setEnabled:YES/NO] ; in your code.

提交回复
热议问题