how to enable/disable NSToolbarItem
问题 I have a project that needs to disable/enable some NSToolbarItem s depends on different options. I checked and found no parameter for this. Is there a way to enable/disable a given NSToolbarItem ? 回答1: Implement NSToolbarItemValidation Protocol in your window, view or document controller. The documentation gives the following sample code: -(BOOL)validateToolbarItem:(NSToolbarItem *)toolbarItem { BOOL enable = NO; if ([[toolbarItem itemIdentifier] isEqual:SaveDocToolbarItemIdentifier]) { // We