参考
注意
配列は NSMutableArray
じゃないと使えないよ
実装
//セルの削除許可を設定
func tableView(_ tableView: UITableView,canEditRowAt indexPath: IndexPath) -> Bool
{
return true
}
//セルの削除ボタンが押された時の処理
func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
if editingStyle == UITableViewCellEditingStyle.delete {
ArrayName.removeObject(at: indexPath.row)
tableView.deleteRows(at: [indexPath as IndexPath], with: UITableViewRowAnimation.automatic)
}
}