如何更改Tableview单元格动作高度?

时间:2020-02-05 20:02:11

标签: swift xcode uitableview uiview ios13

我制作了自定义TableViewCell并添加了“滑动动作”以删除

我想根据我的自定义单元格高度来更改动作高度

enter image description here

func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
    let contextItem = UIContextualAction(style: .destructive, title: "Delete") {  (contextualAction, view, boolValue) in
        self.array.remove(at: indexPath.row)
        self.tableView.deleteRows(at: [indexPath], with: .automatic)
        boolValue(true)
        self.tableView.reloadData()
    }
    let swipeActions = UISwipeActionsConfiguration(actions: [contextItem])

    return swipeActions
}

func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
    return true
}

0 个答案:

没有答案