我有一个UITableView,并且向它添加了编辑操作。现在,我想补充上方的删除按钮标签图像,如:如何在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]
}
我怎么能在我的Delete
按钮添加图像?
@rmaddy但其他开发人员如何做到这一点? –
也许他们正在使用第三方自定义表格视图单元类,而不是使用'UITableViewDelegate'提供的标准API。 – rmaddy
提到这个问题,你会发现你的答案: http://stackoverflow.com/questions/20290766/change-the-color-of-default-red-color-delete-button-in-uitableviewcell-when- swip ---------------- http://stackoverflow.com/questions/29335104/how-add-custom-image-to-uitableview-cell-swipe-to -delete 如果你在iOS8 + –