我想在SwipeGesture和TouchMoved中执行不同的操作。但两者都被调用 当我们刷卡时,请帮忙吗?
Drecoginizer = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(handleSwipeFromD:)];
Drecoginizer.direction = UISwipeGestureRecognizerDirectionDown;
[self.view addGestureRecognizer:Drecoginizer];
答案 0 :(得分:0)
据我了解,如果此滑动位于圆圈之外,则不希望选择器对滑动手势作出反应。在这种情况下,在滑动选择器的开头,您应该检查滑动是否在圆圈上方是这样的:
CGPoint lClick = [recognizer locationOfTouch:0 inView:self.view];
//Distance from the center of the circle to the taped point
int lDistance = sqrt(pow(lClick.x - lCircleCenter.x, 2) + pow(lClick.y - lCircleCenter.y, 2));
if ((int)lDistance > (int)lCircleRadius) {
return;
}
希望它可以帮到你