在删除 Swift 4 时为单元格设置动画
Animate a cell while removing Swift 4
我正在开发一个应用程序,我在其中使用了一些 tableView 单元格。我正在单元格上执行拖放操作,我想删除目标位置的单元格。我正在成功地做到这一点。但在删除该单元格之前,我想为该单元格设置动画。我怎样才能做到这一点。以下是我执行此操作的方法。
override func tableView(_ tableView: UITableView, moveRowAt sourceIndexPath: IndexPath, to destinationIndexPath: IndexPath) {
let movedCell = self.colorArray[destinationIndexPath.row]
self.colorArray.remove(at: destinationIndexPath.row)
self.tableView.reloadData()
}
我想在那个 movedCell 上执行一些动画。
我该怎么做?
这是移除过程中动画的默认系统tableview
。
override func tableView(_ tableView: UITableView, moveRowAt sourceIndexPath: IndexPath, to destinationIndexPath: IndexPath) {
self.tableView.deleteRows(at: [destinationIndexPath], with: .left)
let movedCell = self.colorArray[destinationIndexPath.row]
self.colorArray.remove(at: destinationIndexPath.row)
}
我正在开发一个应用程序,我在其中使用了一些 tableView 单元格。我正在单元格上执行拖放操作,我想删除目标位置的单元格。我正在成功地做到这一点。但在删除该单元格之前,我想为该单元格设置动画。我怎样才能做到这一点。以下是我执行此操作的方法。
override func tableView(_ tableView: UITableView, moveRowAt sourceIndexPath: IndexPath, to destinationIndexPath: IndexPath) {
let movedCell = self.colorArray[destinationIndexPath.row]
self.colorArray.remove(at: destinationIndexPath.row)
self.tableView.reloadData()
}
我想在那个 movedCell 上执行一些动画。 我该怎么做?
这是移除过程中动画的默认系统tableview
。
override func tableView(_ tableView: UITableView, moveRowAt sourceIndexPath: IndexPath, to destinationIndexPath: IndexPath) {
self.tableView.deleteRows(at: [destinationIndexPath], with: .left)
let movedCell = self.colorArray[destinationIndexPath.row]
self.colorArray.remove(at: destinationIndexPath.row)
}