Simulate left dragging UITableViewCell

My goal is to tell early users that cells in my table view are editable. To show this, my goal is to animate a little left drag.

Outside of programmatically generating sensory events, I didn't know if something like this could be achieved using UITableViewRowAction

For example, here is my next implementation for all drag and drop events:

func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? {

        if indexPath.section == 1 {
            let editAction = UITableViewRowAction(style: .normal, title: "Allow") { (rowAction, indexPath) in

                tableView.beginUpdates()
                //...implementation methods not included for brevity 
                tableView.endUpdates() 
            }
            editAction.backgroundColor = DisplayColors.AllViews.WarnColor
            return [editAction]
        } 
}

      

However, the above only works when the user physically drags the cell. I don't know if there is a way to call this programmatically to demonstrate that the cell has this ability.

+3


source to share





All Articles