Reputation: 1948
how to automatically slide the cell when we touch button like adding contact? is there any delegate for that?
Upvotes: 4
Views: 2278
Reputation: 27438
You should implement delegate
method - commitEditingStyle
and you will be done!!
something like,
func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath)
{
// below code will delete one row - you can mange another kind of deletion here like delete from database also
if editingStyle == .Delete
{
yourDataArray.removeAtIndex(indexPath.row)
self.yourTableView.reloadData()
}
}
And you can do on button's click,
self.yourTableView.setEditing(true, animated: true)
to show (-) sign on every cells !
Upvotes: 5