我是 iOS 新手,我UIPanGestureRecognizer在我的项目中使用。在拖动视图时,我需要获取当前的接触点和上一个接触点。我正在努力获得这两点。
如果我使用touchesBeganmethod 而不是 using UIPanGestureRecognizer,我可以通过以下代码得到这两点:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
CGPoint touchPoint = [[touches anyObject] locationInView:self];
CGPoint previous=[[touches anyObject]previousLocationInView:self];
}
UIPanGestureRecognizer我需要在事件触发方法中得到这两点。我怎样才能做到这一点?请指导我。