Re: Can NSView and NSImageView respond to Mouse Clicks?


Keary Suska
 

NSView doesn’t have action handling—you get that from NSControl. If you need action handling, you might need an NSControl subclass rather than an NSView subclass. That being said, you can call your action method “manually” in an event handler for NSView.

As for NSImageView, It doesn’t look like you can specify action handling in Xcode. Have you tried calling -sendActionOn: on your image view?

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"

On Sep 19, 2018, at 12:34 PM, Dave <dave@...> wrote:

Hi,

Can an Custom NSView respond to Mouse Clicks via IBActions?

Can the same be done with NSImageView? I’ve added an image view and connected it to an IBAction method define in my View Controller, but when I click the NSImageView nothing happens…..

Any help greatly appreciated.

Join cocoa@apple-dev.groups.io to automatically receive all group messages.