UITableView Cell swipe delete - 테이블뷰 셀을 밀어서 삭제해보자

2053 단어 swiftswift

tableview DataSource에 다음과 같은 내용을 추가해준다.

func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {
	if editingStyle == .delete {
		데이터배열.remove(at: indexPath.row)
		tableView.deleteRows(at: [indexPath], with: .fade)
        
	} else if editingStyle == .insert {
    }
}

좋은 웹페이지 즐겨찾기