我正在创建一个自动移动的 UICollectionView,无需用户交互,使用:
private func startWaterfallAnimation() {
var timer = Timer.init()
timer = Timer.scheduledTimer(withTimeInterval: 0.06, repeats: true) { (_) in
if !self.isPaused{
UIView.animate(withDuration: 0.06, delay: 0, options: [.curveLinear], animations: {
self.setContentOffset(CGPoint(x: self.contentOffset.x, y: self.contentOffset.y - CGFloat(self.speed)), animated: false)
}, completion: nil)
} else {
timer.invalidate()
}
}
}
不幸的是,这是行为:https://giphy.com/gifs/1xV9RiPlOoSTugIx1s ,细胞在移动时会轻弹。
我的问题是:如何以编程方式在 Apple TV 上平滑滚动,而不需要轻弹?也许另一种方法?
最佳答案
这不是代码问题,我已经尝试过很多方法了。它与电视分辨率有关,像素更大,当尝试以编程方式平滑地滚动某些内容时,如果速度放慢,大多数电视都会闪烁。
关于swift - 编程式滚动 Apple TV 轻拂单元格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49159017/