在Eureka上更改“删除文本”

问题描述 投票:0回答:1

是否有一种方法可以更改ContextualAction的文本,使其不再显示“删除”?

This is the Delete Button that I'm talking about

ios swift eureka-forms uicontextualaction
1个回答
0
投票

您可以简单地创建委托方法,trailingSwipeActionsConfigurationForRowAt,如下所示,并根据需要对其进行自定义:

extension YOURVIEWCONROLLER: UITableViewDelegate{
func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {

    let removeAction = UIContextualAction(style: .destructive, title: "Remove") { action, view, complete in
        //Your code
        Utility.main.showAlert(message: "Removed Pressed", title: "Alert")
        complete(true)
    }
    doneAction.backgroundColor = UIColor.red

    return UISwipeActionsConfiguration(actions: [removeAction])
}
}
© www.soinside.com 2019 - 2024. All rights reserved.