I'm trying to implement a method that gets called in the touchesBegan
method when I tap the screen. How do I add a delay so the method increment
has a downtime of 2 seconds before it can be called again?
int i;
-(void)increment
{
i++;
}
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
/* Called when a touch begins */
for (UITouch *touch in touches) {
CGPoint location = [touch locationInNode:self];
[self increment];
}
}