Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios UITableView deleteRows动画错误(不管rowAnimation变量如何,它总是会淡出)_Ios_Swift_Uitableview_Catransaction - Fatal编程技术网

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()