Skip to content

Instantly share code, notes, and snippets.

@C4Code
Created September 24, 2012 21:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save C4Code/3778707 to your computer and use it in GitHub Desktop.
Save C4Code/3778707 to your computer and use it in GitHub Desktop.
Getting the time between touchesBegan and touchesEnded
#import "C4WorkSpace.h"
@implementation C4WorkSpace {
NSDate *timeButtonWasPressed, *timeButtonWasReleased;
}
-(void)touchesBegan {
timeButtonWasPressed = [NSDate dateWithTimeIntervalSinceNow:0.0f];
}
-(void)touchesEnded {
timeButtonWasReleased = [NSDate dateWithTimeIntervalSinceNow:0.0f];
NSTimeInterval t = [timeButtonWasReleased timeIntervalSinceDate:timeButtonWasPressed];
C4Log(@"%f",t);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment