Search This Blog

Thứ Hai, 1 tháng 1, 2018

Chèn thêm khung delete bên phải cell TableView in IOS

func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
        
      
            return true
        
        
    }
    func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
        
        if editingStyle == .delete {
            if((self.arrNews.count) > 0 ){
                let mdPost = arrNews[indexPath.row] as! ModelNews
                DataManager.deleteToBookmarkOnlyData(md: DataManager.getByIdBookmarkOnlyData(id_news: mdPost.m_object_id!))
                self.reloadData()
            }
        }

    }

Không có nhận xét nào:

Đăng nhận xét