【发布时间】:2019-01-16 19:15:24
【问题描述】:
我使用 SwipeCellKit 为我的 tableview 执行滑动操作。 我尝试对我的单元格的附件类型进行左滑动检查或 unckech 并且一切正常,但是在我按下检查表视图后立即重新加载数据并且我看不到回滚检查按钮的动画。所以我想问一下这个动画结束后我如何调用重新加载数据。
我有这样的事情:
但我想要这样的淡入淡出动画
我的代码:
override func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath, for orientation: SwipeActionsOrientation) -> [SwipeAction]? {
var action = super.tableView(tableView, editActionsForRowAt: indexPath, for: orientation) ?? []
guard orientation == .left else { return action }
let checkAction = SwipeAction(style: .destructive, title: nil) { action, indexPath in
self.completeItem(at: indexPath)
}
action.append(checkAction)
return action
}
private func completeItem(at indexPath: IndexPath){
if let item = itemArray?[indexPath.row]{
do{
try realm.write {
item.done = !item.done
}
}
catch{
print( error.localizedDescription)
}
}
tableView.reloadData()
}
【问题讨论】:
-
使用 SwipeTableViewCellDelegate
标签: ios swift uitableview swipe