I want when user slides from left to right label counter updates from 1 to 5. If I swipe slowly, very slowly it works, faster then that and it doesn't work right? Is there another way to implement this?
I have this code:
-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [touches anyObject];
gestureStartPoint = [touch locationInView:self.view];
}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [touches anyObject];
CGPoint currentPosition = [touch locationInView:self.view];
if ((int)(currentPosition.x)%40 == 0 && counter < 5) {
counter++;
}
[label setText:[NSString stringWithFormat:@"%d", counter]];
}