我有一个单元格的 contentView 动画,希望有 UIPanGestureRecognizer。
UIPanGestureRecognizer 工作正常并检测到触摸,但在动画发生时它不会检测到触摸,直到它完成动画。
是否有解决方法。
这是动画 block
[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];
关于ios - UIPanGestureRecognizer 与约束动画冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38675305/