我有一个表格 View ,每个单元格都包含一个 Collection View 。当用户滚动集合时,如何检测相应的单元格?
func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
if (lastContentOffset.x < (scrollView.contentOffset.x)) {
NotificationCenter.default.post(name: NSNotification.Name(rawValue: "scrolledRight"), object: nil)
}
}
最佳答案
最好的方法应该是像这样创建一个委托(delegate)
protocol TableCellScrollDelegate {
func didSrcoll(cell : UITableViewCell, offset : CGPoint)
}
在您的 TableViewCell 类中,实现 UIScrollViewDelegate
,然后使用协议(protocol)转发消息。
关于ios - 检测滚动的tableviewcell,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47527226/