我一直在嗅探寻找解决方案,但直到现在它还没有结果。我想要做的是确定某个细胞是否从屏幕上消失。迅速确定某一行是否从视图中消失
下面的代码我一直在努力:
func tableView(tableView: UITableView, didEndDisplayingCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) {
let indexPathWatchCell = NSIndexPath(forRow: 4, inSection: 0)
if ((tableView.indexPathsForVisibleRows?.contains(indexPathWatchCell)) == nil){
NSLog("it disappeared!!")
}
}
遗憾的是它不工作,任何想法?
编辑:
为清楚起见,我要做到的是小区设置到CGFloat的(44),当它在视野中消失
当细胞从表 – pedrouan
喔,删除了此方法适用于知道“失踪”比你可以使用
!
(不)。奇怪,当我使用!=无NSLog出现,有趣。任何想法来确定细胞是否从视野中消失? – Led尝试使用UITableViewCell prepareForReuse():由于单元格在不可见时被重用。另请注意,出于性能方面的原因,表格视图会将两个单元格从观看框架中取出(顶部一个,底部一个)。 –