Add swipe to delete UITableViewCell

后端 未结 25 1640
暖寄归人
暖寄归人 2020-11-30 17:50

I am making a CheckList application with a UITableView. I was wondering how to add a swipe to delete a UITableViewCell.

This is my ViewCont

25条回答
  •  难免孤独
    2020-11-30 18:10

    In Swift 4 tableview add, swipe to delete UITableViewCell

    func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? {
        let delete = UITableViewRowAction(style: .destructive, title: "delete") { (action, indexPath) in
            // delete item at indexPath
    
        }
        return [delete]
    }
    

提交回复
热议问题