0

is it possibile to set the left icon (when deleting a row in tableviewcell) to a custom image?

delete icon

Thanks :)

Marco
  • 1,051
  • 1
  • 17
  • 40

1 Answers1

2

Please try the below code into your Your Controller

func tableView(tableView: UITableView, editActionsForRowAtIndexPath indexPath: NSIndexPath) -> [UITableViewRowAction]? {
    let button1 = UITableViewRowAction(style: .default, title: "Your Title If You Want") { action, indexPath in
        print("button1 pressed!")
    }
    if let image = UIImage(named: "yourImage.png"){
        button1.backgroundColor = UIColor(patternImage: image)
    }
    return [button1]
}
Nimantha
  • 6,405
  • 6
  • 28
  • 69
Pushpendra
  • 1,492
  • 1
  • 17
  • 33
  • thx... but this is for the right confirmation delete button.... i'm trying to change the left icon... – Marco Jul 03 '17 at 12:59
  • have you found your answer. if you have found then you can post your answer here so that other people can get help with your question. – Pushpendra Jul 04 '17 at 06:00