I have a UIView
view, and I want to perform some action when user pressed it and then released.
I added a UITapGestureRecognizer
to the view, and it only fires when tap duration is small. If user touches the view, waits a couple of seconds and then lifts his finger, nothing happens. How can I detect "long tap" events?
UILongPressGestureRecognizer
does not work for me because it fires when finger still touches the screen.
You can do this by tracking when
touchesBegan
andtouchesEnded
:You can use it like this: