Aldo Lazuardi Aldo Lazuardi - 1 year ago 183
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

Answer Source

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 !

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download