Skip to content

Instantly share code, notes, and snippets.

@theHellyar
theHellyar / editActionsForRowAtIndexPath
Created November 5, 2014 21:26
editActionsForRowAtIndexPath with optional image as background
func tableView(tableView: UITableView, editActionsForRowAtIndexPath indexPath: NSIndexPath) -> [AnyObject]? {
var deleteAction:UITableViewRowAction = UITableViewRowAction(style: UITableViewRowActionStyle.Default, title: "Delete", handler: { (tvra:UITableViewRowAction!, indexPath:NSIndexPath!) -> Void in
self.baseArray[indexPath.section].removeAtIndex(indexPath.row)
tableView.reloadData()
})
//Change background color
deleteAction.backgroundColor = UIColor(red: 203/255, green: 76/255, blue: 76/255, alpha: 1)
//Optional use image as background, remove 'title' text in declaration / Not ideal implimentation