Aldo Lazuardi Aldo Lazuardi - 3 months ago 76
Swift Question

how to automatically slide/swipe the cell tableviewcell swift 3

how to automatically slide the cell when we touch button like adding contact? is there any delegate for that?

when we clicked the delete button, cell automatically slide


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

And you can do on button's click,

   self.yourTableView.setEditing(true, animated: true)

to show (-) sign on every cells !