본문 바로가기
#모바일 [Mobile]/iOS

[iOS] 테이블 뷰 셀 밀어서 삭제하기 (Add swipe to delete UITableViewCell)

by cy_mos 2019. 7. 2.
반응형
테이블 뷰 셀 밀어서 삭제하기 (Add swipe to delete UITableViewCell)

📄 Add swipe to delete UITableViewCell Source Code by Swift

func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
    return true
}

func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {
    if (editingStyle == .delete) {
        // handle delete (by removing the data from your array and updating the tableview)
    }
}

🚀 REFERENCE

 

Add swipe to delete UITableViewCell

I am making a CheckList application with a UITableView. I was wondering how to add a swipe to delete a UITableViewCell. This is my ViewController.swift: import UIKit class ViewController:

stackoverflow.com

 

반응형

댓글