I've NSButton
in NSView
. The NSView
has NSClickGestureRecognizer
. Now I am able to get action
from NSView
that have NSClickGestureRecognizer
. But the problem is NSButton
is not able click.
How can I solve this problem?
Code:
import Cocoa
class ViewController: NSViewController {
@IBAction func actionGesture(_ sender: NSClickGestureRecognizer) {
print("Gesture Clicked!")
}
@IBAction func actionButton(_ sender: NSButton) {
print("Button Clicked!")
}
}
Screenshot:
Project Link: https://drive.google.com/open?id=1HmbKiqdF9z7SH131IyyfJ21j8KOgabzl
The easyest way to solve this is to arrange the View structure like showen below. So the View connected to the NSClickGestureRecognizer is behind the button.
Hope this helps