【发布时间】:2017-12-28 19:33:22
【问题描述】:
我正在尝试构建一个 UIPanGestureRecognizer 委托,当它达到某个 x 值时移动 UIView 的宽度/高度,但是当值超过阈值时我遇到了这种奇怪的闪烁(在下面的示例中为 65 像素)。
@objc func moveCardRec(sender: UIPanGestureRecognizer){
if sender.translation(in: self).x < -65.0 {
self.makeButtonPop()
} else {
self.makeButtonUnPop()
}
}
当UIView(我想要弹出/动画秒的那个)落后或重置帧时,就像我用平移手势移动x值的视图正在移动一秒钟。没有线索。
附上现在正在发生的事情的 gif。你会看到它在瞬间抖动。 makeButtonPop() 函数只是圆形图像视图框架上的UIView.animate,其中带有复选标记。
【问题讨论】:
标签: ios swift uiview uiviewanimation uipangesturerecognizer