Double Tap for certain part of view
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
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.
use
Point point = [touch locationInView:self.view];
精彩评论