Time between touch began and touch ended

iphone, objective-c

Solution

// add this ivar to your view controller
NSTimeInterval lastTouch;

 // assign the time interval in touchesBegan:
 -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;
 {
     lastTouch = [event timestamp];
 }  


 // calculate and print interval in touchesEnded:
 -(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;
{
    NSTimeInterval touchBeginEndInterval = [event timestamp] - lastTouch;

    NSLog(@"touchBeginEndInterval %f", touchBeginEndInterval);
}   

Problem

Is there any method in objective-c to find the time between touch began and touch ended??

Original source