gpt4 book ai didi

ios - 点击后如何使显示删除和其他操作的 slider 恢复正常状态

转载 作者:行者123 更新时间:2023-11-28 15:46:55 26 4
gpt4 key购买 nike

我正在为我的 tableView 实现自定义 editActionsForRowAt 操作 如何让滑动的单元格在点击时恢复到正常状态 done ,这是我的 ViewController 代码。

override func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? {
let delete = UITableViewRowAction(style: .destructive, title: "Delete") { (action, indexPath) in
list.remove(at: indexPath.row)
list2.remove(at: indexPath.row)
tableView.reloadData()

}

let done = UITableViewRowAction(style: .normal, title: "Done") { (action, indexPath) in

let cell=tableView.cellForRow(at: indexPath) as! CustomCell
cell.makeanimate()
}

share.backgroundColor = UIColor.lightGray
return [delete, done]
}

我的 CustomCellmakeanimate() 函数。当我点击 done 操作时,我希望单元格滑回其正常位置。

最佳答案

您应该在 UITableView 上使用 setEditing(_:animated:) 函数:

tableView.setEditing(false, animated: Bool)

您可以在此处的 Apple 文档中阅读有关此功能的更多信息:https://developer.apple.com/reference/uikit/uitableview/1614876-setediting

关于ios - 点击后如何使显示删除和其他操作的 slider 恢复正常状态,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42888744/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com