serdar aylanc serdar aylanc - 3 months ago 19
Swift Question

editActionsForRowAtIndexPath - how to close the slider after the action completed

What is the way to close the slider after tweet action completed?

func tableView(tableView: UITableView, editActionsForRowAtIndexPath indexPath: NSIndexPath) -> [AnyObject]? {
let tweet = UITableViewRowAction(style: .Normal, title: "Tweet") { action, index in
println("tweet")
}
let done = UITableViewRowAction(style: .Default, title: "Done") { action, index in
println("done")
}
return [tweet, done]
}

Answer

When your action is completed or when you switch from Edit mode can use this called on your tableView:

self.tableView.setEditing(Bool, animated: Bool)

as suggested by @Craig.Pearce