I have a row action button titled "Activate". When I press it, I want the title to change to "Deactivate".
I was unable to change the title in the handler function. Also, "Activate" and "Deactivate" should have different functions.
func tableView(tableView: UITableView, editActionsForRowAtIndexPath indexPath: NSIndexPath) -> [AnyObject]? {
let account = accountTypes[indexPath.section].accounts[indexPath.row]
let delete = UITableViewRowAction(style: UITableViewRowActionStyle.Default, title: "Delete", handler: { (action, indexPath) -> Void in
// action delete
})
let activation = UITableViewRowAction(style: UITableViewRowActionStyle.Default, title: "Activate", handler: { (action, indexPath) -> Void in
// action activate
})
activation.backgroundColor = UIColor.lightGrayColor()
let arrayofactions: Array = [delete, activation]
return arrayofactions
}