jeudi 3 mai 2018

Can not deleting the cells from a segment of tableview in swift ios

I have 4 segments in tableview but when I am trying to delete the cell of specific segment in tableview, but the loops does not enter in the segment because it does not printed the specific prints statements.

    func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
    print("delete")

if editingStyle == .delete {
   print("delete")

    if selectedContact == 1 {
    print("trying to delete from segement one")
    wInstockArray.remove(at: indexPath.row)
    firstTableView.deleteRows(at: [indexPath], with: .fade)
    firstTableView.reloadData()
    }

   else if selectedSegment == 2 {
    print("trying to delete from segement two")
    wCheckinArray.remove(at: indexPath.row)
    firstTableView.deleteRows(at: [indexPath], with: .fade)
    firstTableView.reloadData()
        }

   else if selectedSegment == 3 {
    print("trying to delete from segement three")
    wInspectionArray.remove(at: indexPath.row)
    firstTableView.deleteRows(at: [indexPath], with: .fade)
    firstTableView.reloadData()
        }

   else if selectedSegment == 4 {
    print("trying to delete from segement four")
    wCheckoutArray.remove(at: indexPath.row)
    firstTableView.deleteRows(at: [indexPath], with: .fade)
    firstTableView.reloadData()
        }

        else {
            print("nothing changed")
        }
    }
}

enter image description here

Aucun commentaire:

Enregistrer un commentaire