NSToolbarItem is not a subclass of NSView, so it does not support the addGuestureRecognizer method. If its NSToolbar was not configured, you could get the exact NSToolbar subView by index, and then use the addGuestureRecognizer method. However, if the toolbar is customizable, the index can change, and the user can add and remove a button that requires quite a lot of code for this simple thing.
Is there any solution for this?
source
share