For best practise, you can use button action instead of UITapGesture
by adding UIButton
. the reason is simple, to manage the button is far much simple then the UITapGesture
but I am not saying use UIButton
instead of tap gesture all the time, its all about your requirement.
For your case, add this line
view.userInteractionEnabled = false
and make sure your view is added in the UITapGesture
and UITapGesture
method is properly implemented in your code work.
For more basic, go with these two tutorials,
First tutorial |
Second tutorial
If you still face any problem then let me know.