当滚动到视图外时,我试图删除第一部分。
我使用下面的委托方法尝试了它,但是由于我没有页脚视图,所以没有帮助。
func tableView(_ tableView: UITableView, didEndDisplayingFooterView view: UIView, forSection section: Int)
而且,我尝试使用滚动视图委托
func scrollViewDidEndDragging(_ scrollView: UIScrollView, willDecelerate decelerate: Bool){
let indexPath = tableView.indexPathsForVisibleRows?.first
if indexPath?.section == 1 {
//remove View
}
}
您能告诉我如何检测第一部分何时不可见?
您可以在委托中使用...didEndDisplayingCell...
函数:
func tableView(_ tableView: UITableView, didEndDisplaying cell: UITableViewCell, forRowAt indexPath: IndexPath) {
if indexPath.section == 0 && indexPath.row == lastRowInFirstSection {
// first section is out
}
}