How to disable user interaction in a custom View

Viper OS X picture Viper OS X · Jul 31, 2012 · Viewed 10.4k times · Source

I have a custom View NSView and I want to disable userinteraction, but I'm not sure how to do this.

My idea was:

[myView setEnabled:NO];

but it's wrong and doesn't work. How can I make it so that, it's just visible for the user, and nothing else?

Answer

Ravindhiran picture Ravindhiran · Nov 8, 2013

NSView doesn't have either setEnabled: or setIgnoresMouseEvents:

Implement the hitTest: method to return nil.