Reputation: 1061
is it possibile to set the left icon (when deleting a row in tableviewcell) to a custom image?
Thanks :)
Upvotes: 0
Views: 1585
Reputation: 1521
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]
}
Upvotes: 2