0

i want to do different operation in SwipeGesture and TouchMoved.But both are called when we swipe.any help please?

 Drecoginizer  = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(handleSwipeFromD:)];
Drecoginizer.direction = UISwipeGestureRecognizerDirectionDown;
[self.view addGestureRecognizer:Drecoginizer];
4

1 回答 1

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;
    }

希望对你有帮助

于 2010-12-31T07:45:17.467 回答