Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone iOS-如何在识别任何触摸手势时停止视图动画_Iphone_Objective C_Ios_Cocoa Touch - Fatal编程技术网

Iphone iOS-如何在识别任何触摸手势时停止视图动画

Iphone iOS-如何在识别任何触摸手势时停止视图动画,iphone,objective-c,ios,cocoa-touch,Iphone,Objective C,Ios,Cocoa Touch,我有一个UIView,我在上面添加了PangestureRecognitizer,我的UI将表现为平移,在平移手势结束后,它应该继续沿着该方向移动,并减速。我已经做到了。我显示减速一个街区 [UIView animateWithDuration:slideFactor*2 delay:0 options:UIViewAnimationOptionCurveEaseOut | UIViewAnimationOpti

我有一个UIView,我在上面添加了PangestureRecognitizer,我的UI将表现为平移,在平移手势结束后,它应该继续沿着该方向移动,并减速。我已经做到了。我显示减速一个街区

[UIView animateWithDuration:slideFactor*2
                      delay:0
                    options:UIViewAnimationOptionCurveEaseOut | UIViewAnimationOptionAllowUserInteraction
                 animations:^{
                     _movieView.center = finalPoint;
               } completion:nil];
现在,在动画过程中,如果它识别出另一个触摸、轻触或平移,它应该在该点停止。因此,可以进行进一步的平移

我的PangestureRecognitor选择器方法是这样做的

if ([panGesture state] == UIGestureRecognizerStateChanged)
{
    [self mpvGestureStateBeginOrChanged:panGesture];
}
if ([panGesture state] == UIGestureRecognizerStateEnded)
{
    [self mpvGestureStateEnd:panGesture];
}
if ([panGesture state] == UIGestureRecognizerStateBegan) 
{
    [self.view.layer removeAllAnimations];
    // It stops at the final end position of the view
    // I want to stop animation right at the this point.
}
注意由于UI的一些限制,我无法使用UIScrollView。
请给我一些建议或解决问题

请查看此帖子中提出的问题。谢谢,我已经阅读了,但没有找到解决方案只需检查您在按钮上添加的手势,我认为您正在添加Pangesture,只需添加Tap手势或LongPrssGesture,还有一件事您必须更改动画选项use
UIViewAnimationOptionAllowUserInteraction
听起来您只是在实现UIScrollView。这是故意的吗?几乎,我已经添加了一些额外的东西,只是坚持这个东西,其他的一切都已经完成了。请查看此帖子中提出的问题。谢谢,我已经阅读了,但没有找到解决方案只需检查一下你在按钮上添加的手势,我认为你正在添加Pangesture,只需添加Tap手势或LongPrssGesture,还有一件事您必须更改动画选项use
UIViewAnimationOptionAllowUserInteraction
听起来您只是在实现UIScrollView。这是故意的吗?几乎,我在其中添加了一些额外的东西,只是坚持做这件事,其他一切都已经做了。