Search code examples
iphoneuigesturerecognizeruiswipegesturerecognizer

Get touch position while swiping


anyone is aware of a way to get the current touch position (not start or end position) while user is swiping?

Something like the

-(void)scrollViewDidScroll:(UIScrollView *)scrollView{
    NSLog(@"%f", scrollView.contentOffset.x);
}

but for UISwipeGestureRecognizer

Thanks,

Max


Solution

  • Use PanGestureRecognizer

    - (void)onDraggingLetter:(UIPanGestureRecognizer *)panGR {
    CGPoint translation = [panGR translationInView:baseView];
    
        if (panGR.state == UIGestureRecognizerStateBegan) {
        } else if (panGR.state == UIGestureRecognizerStateChanged) { 
        }
        else if (panGR.state == UIGestureRecognizerStateEnded) {
        }
    }