【发布时间】:2016-09-29 10:32:30
【问题描述】:
我正在使用计时器并打印UIScrollView 的contentOffset.y 以一直跟踪它。
但问题是UIScrollView 仅在减速后更新其contentOffset 值。
我想知道计时器每毫秒的contentOffset.y值,我该怎么做?如果我根本无法使用UIScrollView 的contentOffset,有没有其他方法可以跟踪滚动视图的contentOffset.y 的类似值?
我正在使用 swift。谢谢。
【问题讨论】:
-
你能把你迄今为止尝试过的代码贴出来吗?
-
let timer = Timer.scheduledTimer(timeInterval: 0.01, target: self, selector: #selector(self.timTick), userInfo: nil, repeats: true) //declare the time func timTick() { let scrOffset = scrollView.contentOffset.y print(scrOffset) } //print every 0.01 second@PoojaSrivastava
标签: ios swift uiscrollview contentoffset