我有一個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 + –