私のテーブルには、UITableViewRowAction
forがありeditActionsForRowAtIndexPath
ます。それを押すと、配列内のすべてのデータが削除され、その結果、配列の がトリガーdidSet
され、ビューが変更されます。コードは次のようになります。
var data: [Int] = [Int]() {
didSet {
if data.isEmpty {
// change view
}
}
}
func tableView(tableView: UITableView, editActionsForRowAtIndexPath indexPath: NSIndexPath) -> [AnyObject]? {
var confirm = UITableViewRowAction(style: .Default, title: "Confirm") { (action: UITableViewRowAction!, indexPath: NSIndexPath!) -> Void in
self.data.removeAll(keepCapacity: false)
self.tableView.setEditing(false, animated: true)
}
return [confirm]
}
私が取得したいのは、アニメーションが終了した後のある種の完了UITableViewRowAction
です(行がその場所に戻ります)。その後、配列を空にしてビューを変更します。可能であれば、手動遅延の使用を避けたいと思います。