Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/41.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 在刷卡时获得触摸位置_Iphone_Uigesturerecognizer_Uiswipegesturerecognizer - Fatal编程技术网

Iphone 在刷卡时获得触摸位置

Iphone 在刷卡时获得触摸位置,iphone,uigesturerecognizer,uiswipegesturerecognizer,Iphone,Uigesturerecognizer,Uiswipegesturerecognizer,有人知道在用户刷卡时获取当前触摸位置(不是开始或结束位置)的方法吗 类似于 -(void)scrollViewDidScroll:(UIScrollView *)scrollView{ NSLog(@"%f", scrollView.contentOffset.x); } 但是对于UISweepGestureRecognitor 谢谢 MaxUISweepGestureRecognitor类仅提供手势和方向的起点。但是,uipangestureerecognizer会反复调用其关联的动

有人知道在用户刷卡时获取当前触摸位置(不是开始或结束位置)的方法吗

类似于

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

谢谢


Max

UISweepGestureRecognitor类仅提供手势和方向的起点。但是,
uipangestureerecognizer
会反复调用其关联的动作方法,您每次都可以获取手势的当前位置(使用
locationInView:

使用
PanGestureRecognizer

- (void)onDraggingLetter:(UIPanGestureRecognizer *)panGR {
CGPoint translation = [panGR translationInView:baseView];

    if (panGR.state == UIGestureRecognizerStateBegan) {
    } else if (panGR.state == UIGestureRecognizerStateChanged) { 
    }
    else if (panGR.state == UIGestureRecognizerStateEnded) {
    }
}

为此,您必须使用
PangestureRecognitizer
…UIgestureRecognitizer具有
locationInView
。@山狮:谢谢,它工作完美。如果你想把答案贴出来,我会接受的。