0
editActionsForRowAt
のアクションはtableView
です。タップしたときにスライダセルを元の状態に復帰させるにはどうすればいいですか?done
私のViewControllerのコードです。削除を表示しているスライダをタップすると他の動作が正常な状態に戻るのはどうすればいいですか
override func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? {
let delete = UITableViewRowAction(style: .destructive, title: "Delete") { (action, indexPath) in
list.remove(at: indexPath.row)
list2.remove(at: indexPath.row)
tableView.reloadData()
}
let done = UITableViewRowAction(style: .normal, title: "Done") { (action, indexPath) in
let cell=tableView.cellForRow(at: indexPath) as! CustomCell
cell.makeanimate()
}
share.backgroundColor = UIColor.lightGray
return [delete, done]
}
私CustomCell
はmakeanimate()
機能を持っています。 done
アクションをタップすると、セルを元の位置に戻したいと思っています。
あなたは 'tableView.setEditing(アニメーション、偽:true)を意味' –
@LeoDabusこれはおそらく望ましい効果ですが、アニメーション化するべきかどうかは、実装する人の責任です。したがって、私は値を提供しませんでした:-) – Frederik