The following is from documentation :
Although taps are discrete gestures, they are discrete for each state of the gesture recognizer; thus the as
The UITapGestureRecognizer
only fires when the gesture state is UIGestureRecognizerStateEnded
If you want to use a gesture recogniser to detect the start and end of a press, use the UILongPressGestureRecognizer
, with the minumumPressDuration
set to 0
Why don't you use - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
method ?
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
NSDate *date1 = [NSDate date]; //user touches the screen
}
-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
NSDate *date2 = [NSDate date]; //user lifts his finger away from the screen
}