我正在创建一个任务列表。您可以通过滑动单元格并单击滑动按钮来标记任务和完成。.destructive样式使单元格立即消失,这在这里看起来不太好。我想让它慢一点(可以先褪色,然后消失)。
我正在学习Swift,不知道怎么做,也没有在网上找到任何提示。有人能帮帮我吗?
这是我的妙招:
override func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
let markAsDone = UIContextualAction(style: .destructive, title: "DONE") { (doneAction, view, isSuccess) in
print("User marked task as done")
isSuccess(true)
}
markAsDone.backgroundColor = UIColor.lightGray
return UISwipeActionsConfiguration(actions: [markAsDone])
}发布于 2019-02-18 18:05:54
你可以试试这样的东西,
tableView.beginUpdates()
tableView.deleteRows(at: indexPath, with: .fade) // Use your desired indexPath
tableView.endUpdates()https://stackoverflow.com/questions/54744603
复制相似问题