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