UIPanGestureRecognizer 与约束动画冲突

UIPanGestureRecognizer conflict with constraints animation

我有一个单元格的 contentView 动画,希望有 UIPanGestureRecognizer。

UIPanGestureRecognizer 可以正常工作并检测到触摸,但在动画发生时它不会检测到触摸,直到它完成动画。

是否有解决方法。

这是动画块

[self.myContentView layoutIfNeeded];
self.contentViewLeftConstraint.constant = -50;
self.contentViewRightConstraint.constant = 50;

[UIView animateWithDuration:duration delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{
    [self.myContentView layoutIfNeeded];
} completion:completion];

谢谢。

如果您想在动画期间允许用户交互,您必须设置允许它的选项:

UIViewAnimationOptions options = UIViewAnimationOptionCurveEaseOut |
    UIViewAnimationOptionAllowUserInteraction;
[UIView animateWithDuration:duration delay:0 options:options animations:^{
    [self.myContentView layoutIfNeeded];
} completion:completion];