如何在UITableView删除按钮上添加图像?

Ork*_*ade 13 uitableview ios swift

我有一个UITableView,我已经添加了编辑操作.现在我想在删除按钮标签上方添加图像,如下所示:

在此输入图像描述

这是我的代码:

func tableView(tableView: UITableView, editActionsForRowAtIndexPath indexPath: NSIndexPath) -> [UITableViewRowAction]? {

    let blockAction = UITableViewRowAction(style: .Normal, title: "Block") { (rowAction:UITableViewRowAction, indexPath:NSIndexPath) -> Void in
        //TODO: Delete the row at indexPath here
    }
    blockAction.backgroundColor = UIColor.redColor()

    return [blockAction]
}
Run Code Online (Sandbox Code Playgroud)

如何在Delete按钮上添加图像?

Aru*_*pta 0

您可以实现一个可滑动的 tableviewcell 来完成此操作,您可以在其中实现用于编辑操作的自定义按钮。有很多这方面的教程。检查以下一项:

https://www.raywenderlich.com/62435/make-swipeable-table-view-cell-actions-without-going-nuts-scroll-views


归档时间:

查看次数:

5914 次

最近记录:

8 年,10 月 前