state for UITapGestureRecognizer

The UIGestureRecognizer reference says: "discrete events such as a tap or a swipe can not report changes within the gesture"

How can I get notified when a finger is just touching the screen (and hasn't left it yet), and get then notified when it leaves the screen?

Thanks for your help!


you can detect touches by using

ObjC answer:

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event

Swift 3.0 answer:

func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?)
func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?)

Well your answer lies in your question title i.e. UIGestureRecognizerState. You need to check for the state of the gestureRecognizer in the target method. like:

- (void)handleTap:(UITapGestureRecognizer *)sender {
           if (sender.state == UIGestureRecognizerStateEnded)     {
                // handling code     
           else {
                //do anything else


These are the possible enums:

UIGestureRecognizerStateRecognized = UIGestureRecognizerStateEnded

May be that'll help.

Need Your Help

arraylist with method

java arraylist methods output

As my last question obviously was a little bit unclear (I applogise for that), I'm making a new try, and this time I will really try to be clear.

Java-Fake system clock in launch

java date

For a workaround , I need to change the system clock for a certain java program without touching the code in order to get for :