我有一个 UITableView,它有一个带有自定义圆角半径的 UITableViewCells 列表。滑动编辑时,ei 删除/插入,圆角半径重置为 0。
我试图在编辑时设置角半径:
override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {
guard let cell = tableView.cellForRow(at: indexPath) as? HabitTableViewCell else { return }
cell.layer.cornerRadius = 13
if editingStyle == .delete {
controller.delete(habit: frc.object(at: indexPath))
}
}
Run Code Online (Sandbox Code Playgroud)
我也尝试过以类似的方式实现 willBeginEditingRowAt 以尝试使拐角半径保持不变。我尝试的最后一件事是在 trailingSwipeActionsConfigurationForRowAt 中创建自定义 UIContextualAction,但它不会改变任何东西。