2013-01-16 60 views
0

任何人知道的一种方式来获得当前触摸位置(不启动或结束位置),同时用户在刷卡?获取触摸位置,同时刷卡

有点像

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

但对于UISwipeGestureRecognizer

谢谢,

最大

+0

的,你必须使用'PanGestureRecognizer' ... – Venkat

+0

UIGestureRecognizer已'locationInView' – Larme

+0

@Mountain狮子:谢谢,它完美的作品。如果你想发布答案,我会接受它。 – masgar

回答

0

使用PanGestureRecognizer

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

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

UISwipeGestureRecognizer类只提供了手势和所述方向的起点。然而,UIPanGestureRecognizer重复调用它相关的操作方法,你可以得到手势的当前位置(使用locationInView:)各一次。