iOS:Multiple UIView 动画问题
iOS:Multiple UIView Animation issue
由于用户交互(在集合视图上连续滚动),我在 UIViewAnimation 中遇到问题。当用户滚动集合视图时,下图中的红线冻结(不向前移动)。当用户停止集合滚动线时正在移动。
注意:对于线条移动,我使用的是 UIViewAnimation。
观察:我正在考虑当用户滚动集合视图时此操作在主队列上执行,这就是红线冻结的原因。
如何避免这个拦截器?。我希望用户连续滚动集合视图而不冻结红线。
**
Finally, i solved above problem by adding animation timer in run loop.
e.g
func updateLine() {
//line animation code goes here.
}
let animationTimer = Timer.scheduleTimer(timerInterval: 1, target: self, selector: #selector(self.updateLine), userInfo: nil, repeats: true)
RunLoop.current.add(animationTimer, forMode: RunloopMode.UITrackingRunLoopMode)
that's it
**
由于用户交互(在集合视图上连续滚动),我在 UIViewAnimation 中遇到问题。当用户滚动集合视图时,下图中的红线冻结(不向前移动)。当用户停止集合滚动线时正在移动。
注意:对于线条移动,我使用的是 UIViewAnimation。 观察:我正在考虑当用户滚动集合视图时此操作在主队列上执行,这就是红线冻结的原因。
如何避免这个拦截器?。我希望用户连续滚动集合视图而不冻结红线。
**
Finally, i solved above problem by adding animation timer in run loop.
e.g
func updateLine() {
//line animation code goes here.
}
let animationTimer = Timer.scheduleTimer(timerInterval: 1, target: self, selector: #selector(self.updateLine), userInfo: nil, repeats: true)
RunLoop.current.add(animationTimer, forMode: RunloopMode.UITrackingRunLoopMode)
that's it
**