Return to Snippet

Revision: 33062
at October 5, 2010 18:17 by tenveer


Initial Code
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{	

	UITouch *touch = touches.anyObject;
    _dragStartPos = [touch locationInView:self];
	
/////////Logic To Handle Single and Double Tap

	//the the first tap delegate message if its a double tap and so on
	[NSObject cancelPreviousPerformRequestsWithTarget:self
											 selector:@selector(singleTap)
											   object:nil];
	
	[NSObject cancelPreviousPerformRequestsWithTarget:self
											 selector:@selector(doubleTap)
											   object:nil];
	
	//logic to get the tap count
	if(touches.count == 1)
	{  
		if([[touches anyObject] tapCount] == 2)
		{
			[self performSelector:@selector(doubleTap)
					   withObject:nil
					   afterDelay:0.35]; 
		}
		else if([[touches anyObject] tapCount] == 3)
		{
			[self trippleTap];
		}
		else
		{
			[self performSelector:@selector(singleTap)
					   withObject:nil
					   afterDelay:0.35]; 
		}
	}
	
	
}

Initial URL


Initial Description
execute different functions on single or double tap

Initial Title
getting a single a double tap touch event

Initial Tags


Initial Language
Objective C