Ios 如何从起始点和滚动点查找端点坐标

Ios 如何从起始点和滚动点查找端点坐标,ios,endpoint,uiswipegesturerecognizer,Ios,Endpoint,Uiswipegesturerecognizer,我必须从起点和移动点找到端点 我正在制作动画,当用户拖动视图时,我需要移动视图,然后我必须将其移出屏幕并恢复到原点 现在我已经使用了UISweepGestureRecognitor来检测移动中的滑动。下面是代码 UISwipeGestureRecognizer *swipeLeft = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipe:)]; UISwipeGesture

我必须从起点和移动点找到端点

我正在制作动画,当用户拖动视图时,我需要移动视图,然后我必须将其移出屏幕并恢复到原点

现在我已经使用了UISweepGestureRecognitor来检测移动中的滑动。下面是代码

 UISwipeGestureRecognizer *swipeLeft = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipe:)];
    UISwipeGestureRecognizer *swipeRight = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipe:)];
    UISwipeGestureRecognizer *swipeUp = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipe:)];
    UISwipeGestureRecognizer *swipeDown = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipe:)];

    // Setting the swipe direction.
    [swipeLeft setDirection:UISwipeGestureRecognizerDirectionLeft];
    [swipeRight setDirection:UISwipeGestureRecognizerDirectionRight];
    [swipeUp setDirection:UISwipeGestureRecognizerDirectionUp];
    [swipeDown setDirection:UISwipeGestureRecognizerDirectionDown];

    // Adding the swipe gesture on image view
    [_view1   addGestureRecognizer:swipeLeft];
    [_view1 addGestureRecognizer:swipeRight];
    [_view1 addGestureRecognizer:swipeUp];
    [_view1 addGestureRecognizer:swipeDown];
处理刷卡

- (void)handleSwipe:(UISwipeGestureRecognizer *)swipe {

    CGPoint movedPoint = [swipe locationInView:swipe.view];

    if (swipe.direction == UISwipeGestureRecognizerDirectionLeft) {
        NSLog(@"Left Swipe");

        CGPoint startPoint = _view1.frame.origin;
        //Diffence Moved
        float movedDiffence_X = startPoint.x - movedPoint.x;
        float movedDiffence_Y = startPoint.y - movedPoint.y;
        //How can I find END POINT BASED ON THIS DATA

        [UIView animateWithDuration:1 animations:^{
            _view1.center = CGPointMake(movedDiffence_X *3,movedDiffence_Y *3 );
            _view1.transform = CGAffineTransformMakeRotation(-0.86);
        } completion:^(BOOL finished) {
            [UIView animateWithDuration:0.8 animations:^{
                _view1.center = CGPointMake(84, 240);
                _view1.transform = CGAffineTransformMakeRotation(0.36);
            } completion:^(BOOL finished) {

            }];
        }];

    }
    if (swipe.direction == UISwipeGestureRecognizerDirectionRight) {
        NSLog(@"Right Swipe");
        CGPoint startPoint = _view1.frame.origin;
        //Diffence Moved
        float movedDiffence_X = startPoint.x - movedPoint.x;
        float movedDiffence_Y = startPoint.y - movedPoint.y;

        //How can I find

        [UIView animateWithDuration:1 animations:^{
            _view1.center = CGPointMake(movedDiffence_X *3,movedDiffence_Y *3 );
            _view1.transform = CGAffineTransformMakeRotation(-0.86);
        } completion:^(BOOL finished) {
            [UIView animateWithDuration:0.8 animations:^{
                _view1.center = CGPointMake(84, 240);
                _view1.transform = CGAffineTransformMakeRotation(0.36);
            } completion:^(BOOL finished) {

            }];
        }];
    }

    if (swipe.direction == UISwipeGestureRecognizerDirectionUp) {
        NSLog(@"Up Swipe");

        CGPoint startPoint = _view1.frame.origin;
        //Diffence Moved
        float movedDiffence_X = startPoint.x - movedPoint.x;
        float movedDiffence_Y = startPoint.y - movedPoint.y;

        //How can I find

        [UIView animateWithDuration:1 animations:^{
            _view1.center = CGPointMake(movedDiffence_X *3,movedDiffence_Y *3 );
            _view1.transform = CGAffineTransformMakeRotation(-0.86);
        } completion:^(BOOL finished) {
            [UIView animateWithDuration:0.8 animations:^{
                _view1.center = CGPointMake(84, 240);
                _view1.transform = CGAffineTransformMakeRotation(0.36);
            } completion:^(BOOL finished) {

            }];
        }];
    }
    if (swipe.direction == UISwipeGestureRecognizerDirectionDown) {
        NSLog(@"Down Swipe");

        CGPoint startPoint = _view1.frame.origin;
        //Diffence Moved
        float movedDiffence_X = startPoint.x - movedPoint.x;
        float movedDiffence_Y = startPoint.y - movedPoint.y;

        //How can I find

        [UIView animateWithDuration:1 animations:^{
            _view1.center = CGPointMake(movedDiffence_X *3,movedDiffence_Y *3 );
            _view1.transform = CGAffineTransformMakeRotation(-0.86);
        } completion:^(BOOL finished) {
            [UIView animateWithDuration:0.8 animations:^{
                _view1.center = CGPointMake(84, 240);
                _view1.transform = CGAffineTransformMakeRotation(0.36);
            } completion:^(BOOL finished) {

            }];
        }];
    }

}

当我滑动1号视图时,我可以在SwipeHandler(HandleSweep)方法中获得移动点

所以我还可以检测到刷卡的方向。但我的问题是,我必须通过屏幕外的第一视图。为此,我必须找到端点


那么,如何从起点和移动点找到端点呢?

这里是端点计算的链接