2017-03-19 11 views
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] 
} 

CustomCellmakeanimate()機能を持っています。 doneアクションをタップすると、セルを元の位置に戻したいと思っています。

答えて

1

あなたはのUITableView上setEditing(_:animated:)機能を使用する必要がありますあなたがここにAppleのドキュメントで機能の詳細を読むことができます

tableView.setEditing(false, animated: Bool) 

を:https://developer.apple.com/reference/uikit/uitableview/1614876-setediting

+1

あなたは 'tableView.setEditing(アニメーション、偽:true)を意味' –

+0

@LeoDabusこれはおそらく望ましい効果ですが、アニメーション化するべきかどうかは、実装する人の責任です。したがって、私は値を提供しませんでした:-) – Frederik

関連する問題