【问题标题】:Change "Delete Text" on Swipe Eureka在滑动 Eureka 上更改“删除文本”
【发布时间】:2020-03-22 23:30:48
【问题描述】:

有没有办法改变 ContextualAction 的文本,让它不再说“删除”?

【问题讨论】:

    标签: ios swift eureka-forms uicontextualaction


    【解决方案1】:

    您可以像下面这样简单地创建委托方法, 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])
    }
    }
    

    或者

    在 Core.swift 文件中你需要编辑它的功能。

    【讨论】:

    • 我已经尝试过了,但它并没有按照我想要的方式工作。由于我正在使用 Eureka 框架,我想知道是否有内置方法来更改文本。不幸的是,您的解决方案在这种情况下不起作用。
    • @PhilipDz 编辑 core.swift 文件中的 tableview 委托函数。
    猜你喜欢
    • 2018-09-03
    • 1970-01-01
    • 2016-12-12
    • 1970-01-01
    • 2019-09-07
    • 2017-08-05
    • 1970-01-01
    • 1970-01-01
    • 2023-03-12
    相关资源
    最近更新 更多