How to call gesture tap on UIView programmatically in swift

I have a UIView and and I have added tap gesture to it:

let tap = UITapGestureRecognizer(target: self, action: Selector("handleTap:"))
tap.delegate = self
myView.addGesture(tap)

I am trying to call it programmatically in the testfile.

sendActionForEvent

I am using this function, but it is not working:

myView.sendActionForEvent(UIEvents.touchUpDown)

It shows unrecognised selector sent to instance.

How can I solve this problem?

24 Answers
24

Leave a Comment