如何更改 UIContextualAction 按钮的标题颜色和图像色调颜色

时间:2021-03-04 12:57:56

标签: ios objective-c swift xcode

我想更改按钮的标题和图像色调颜色,但我无法做到这一点。 没有这样的属性或方法可以改变。

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

 let discardButton = UIContextualAction(style: .normal, title:  "DISCARD", handler: { (ac:UIContextualAction, view:UIView, success:(Bool) -> Void) in
            print("discardButton action ...")
            success(true)
        })
        discardButton.image = UIImage(systemName: "xmark.circle.fill")
       
        discardButton.backgroundColor = .red


        return UISwipeActionsConfiguration(actions: [discardButton])
    }


我想更改文本颜色和图像色调颜色。

Shell 我们将按钮重叠到 UITableView Cell 就像这张图片

enter image description here

0 个答案:

没有答案
相关问题