Question

I am bit stacked with a functionality that should perform a certain task after double taping on a certain place on UIView. I know how to count number of taps, but do not know how to determinate which place has been tapped and I guess to compare with CGRect of view which was specified for doing this action.

thanx in advance

Was it helpful?

Solution

We can detect with touchesBegan

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
     NSUInteger numTaps = [[touches anyObject] tapCount];
UITouch* t;

if([[event allTouches] count]==2)//double tap
    {
     t=[[[event allTouches] allObjects] objectAtIndex:0];
 CGPoint p1=[t locationInView:self.view];
     }

numTaps gives the nuber of taps .

P1 has the point where it is tapped.

All the best.

OTHER TIPS

use

Point point = [touch locationInView:self.view];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top