我有桌面视图。在单元格内部,我有方法在单元格内动画查看。桌面视图的最后一个单元格内的动画
func animateCell() {
UIView.animate(withDuration: 0.4, animations: { [weak self] in
self?.quantityBackround.transform = CGAffineTransform(scaleX: 25, y: 25)
}) { [weak self] _ in
UIView.animate(withDuration: 0.1) {
self?.quantityBackround.transform = CGAffineTransform.identity
}
}
}
我也有prepareForReuse()
override func prepareForReuse() {
quantityBackround.transform = CGAffineTransform.identity
}
动画只能当数据源改变阵列和我做这个物业观察者像这样(火灾时,东西被添加到工作的最后一个单元格array)
guard let cell = checkTableView.cellForRow(at: IndexPath(row: viewModel.checkManager.check.count - 1, section: 0)) as? CheckItemTableViewCell else { return }
cell.animateCell()
所有这些工作正常。
我遇到的一个问题是,当tableView重新加载时,所有单元格中的所有背景视图都会从零大小扩展到其初始大小。最后的单元格动画确定。
我认为我错过了prepareForReuse中的一些东西,并且因为这个,我看到了这个从零到初始大小的小问题。
如何解决?
你只需要在最后一个单元格动画的这种方法吗? –
是的,只有最后一个 –