在UITableView
我可以向下滚动以查看更多底部单元格。当然,最顶级的细胞离开了屏幕。然后我删除了tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Top)
的单元格。剩余的细胞平稳移动以填充缺失细胞的间隙。这有效,直到我为行高添加自动尺寸。
但是,当我为行高设置自动尺寸并删除底部单元格时,剩余的单元格立即向下滑动以填补间隙。没有动画。我想这与设置自动尺寸有关,因为没有它,细胞移动顺畅。
即使我使用自动尺寸,如何让细胞顺利滑下?
在viewDidLoad()
中,我使用以下行设置自动行维度:
tableView.rowHeight = UITableViewAutomaticDimension
tableView.estimatedRowHeight = 100
这就是我删除单元格的方法:
tableView.beginUpdates()
tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Top)
tableView.endUpdates()