Ios UITableView deleteRows动画错误(不管rowAnimation变量如何,它总是会淡出)
我正在使用Ios UITableView deleteRows动画错误(不管rowAnimation变量如何,它总是会淡出),ios,swift,uitableview,catransaction,Ios,Swift,Uitableview,Catransaction,我正在使用RowAnimation从UITableView中删除一行。left应该非常简单 写下 tableView.deleteRows(位于:[indexPath],带:.left),但问题来了UITableView不尊重我传递的行动画(左、右、上、下、淡入),它只显示正常动画 我尝试过不同的解决方案,比如 beginUpdates() deleteRows(at: indexPath, with: .left) endUpdates() 我也尝试过使用performBatchUpda
RowAnimation
从UITableView
中删除一行。left
应该非常简单
写下
tableView.deleteRows(位于:[indexPath],带:.left)
,但问题来了UITableView
不尊重我传递的行动画(左、右、上、下、淡入)
,它只显示正常动画
我尝试过不同的解决方案,比如
beginUpdates()
deleteRows(at: indexPath, with: .left)
endUpdates()
我也尝试过使用
performBatchUpdates
,我很确定这是一种bug,因为它在以前的iOS版本中运行,我使用的是iOS 13和swift 5
还有一些其他的答案,比如,但是没有一个有效不确定是否相关,但是你可以删除
beginUpdates()
和endUpdates()
-我想这些已经不再需要了。你试过使用performBatchUpdates
?什么是“不尊重我传递的行动画”
是什么意思?@koen是的,我已经有了,没有工作also@hongsy我的意思是,当我使用tableView.deleteRows(位于:[indexPath],带:。left)时,行应该向左设置动画,但实际上它是以淡入淡出的方式设置动画的,如果您在示例项目中尝试使用它,无论rowAnimation u传递的是什么,实际动画都是淡入淡出的
CATransaction.begin()
CATransaction.setCompletionBlock({
self.tableView.beginUpdates()
self.myViewModel?.items?.remove(at: indexPath.row)
self.tableView.deleteRows(at: [indexPath], with: UITableViewRowAnimation.top)
self.tableView.endUpdates()
})
self.tableView.setEditing(false, animated: true)
CATransaction.commit()
self.tableView.beginUpdates()
// ...
self.tableView.endUpdates()
self.tableView.layer.removeAllAnimations()