[英]RxSwift - mapping contentOffset of UITableView
I'm trying to apply some logic to a component when a UITableView
is scrolled, but I can't map the contentOffset
property to return the y
's value. 我正在尝试在滚动
UITableView
时将一些逻辑应用于组件,但我无法映射contentOffset
属性以返回y
的值。
I'm testing like this but nothing happens: 我正在测试这样但没有任何反应:
table.rx.contentOffset.map {debugPrint($0)}
How can I do that? 我怎样才能做到这一点?
Map on its own will do nothing. 地图本身无济于事。 You need to subscribe to the stream:
您需要订阅该流:
table.rx.contentOffset.subscribe {
print("offset now \($0.element)")
}.disposed(by: disposeBag)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.