iOS8 добавляет новый метод к UITableViewDelegate
:
optional func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]?
Вы можете создать настраиваемое UITableViewRowAction
, какое устройство ваши действия строки.
Например:
func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? {
let deleteAction = UITableViewRowAction(style: .destructive, title: "Cancel", handler: { action, indexPath in
// DELETE ROW HERE
})
deleteAction.background = .green // you can change background color
return [deleteAction]
}
Для дополнительной проверки здесь и здесь
Хороший пример использования нового API: здесь