我需要知道当前滚动中隐藏了多少个第一个单元格UITableView
。换句话说,在单元格坐标的哪一点尚未覆盖该单元格?
将contentOffset
不能使用,因为我会自己计算。
您必须获取indexPath
第一个可见行,然后将其原点转换为单元格的坐标:
if let firstVisibleIndexPath = indexPathsForVisibleRows?.first {
if let cell = cellForRowAtIndexPath(firstVisibleIndexPath) {
let coveredHeightOfFirstVisibleCell = tableView.superview!.convertPoint(tableView.frame.origin, toView: cell).y
}
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句