0

I have two uiviewcontrollers for filter purpose, from the first controller using the button i could present the second view controller, from the second view controller i have a tableview and select their rows and passing those row values to the first view controller. It passes the values good, but i again click the same button of the first controller, like wise previous it opens the second controller but the rows i already selected seem unselected.

sample code: for clicking the First controller button for opening the view controller

    @objc func empFilterButton(_ sender: Any){
        let controller = EmployeeFilterViewController()
        self.navigationController?.pushViewController(controller, animated: true)

    }

sample code: for selecting the rows and pass those values to first view controller

@objc func applyFilter(_ sender: Any){
    let empViewCtrl = EmployeeViewController()
    empViewCtrl.deptIdString = deptIdString
    empViewCtrl.dateIdString = dateIdString
    empViewCtrl.shiftIdString = shiftIdString
    empViewCtrl.locationIdString = locationIdString
    self.navigationController?.pushViewController(empViewCtrl, animated: true)
}
PGDev
  • 23,751
  • 6
  • 34
  • 88
  • `EmployeeViewController()` creates a brand new instance. It's most likely a different instance as the *first* one. A better solution might be a segue. – vadian Sep 23 '20 at 12:40
  • @vadian, for this application i haven't use segue concept – FT Testing Sep 23 '20 at 12:49

0 Answers0