Search code examples
cocoansbutton

Non-square NSButton


How to create a NSButton with non-square "hit area"?

Example:

enter image description here

Thanks.


Solution

  • You could probably subclass NSButton and override hitTest: to return nil when outside the area you want to be clickable. (Return [super hitTest:] when inside.)

    Docs here.