I have a question about Sending the value back to the main page After login-> Page 1-> page2-> press home button -> page 1 When I go, there is no problem with the delivery. But I want to press the home button and return the value to page1
this out put on page 2
pShipmentDCBeforeLoad==>Optional("4505023274")
pPlanDateDCBeforeLoad==>Optional("20190119")
TruckIdDCBeforeLoad==>Optional("2")
ptruckNoDCBeforeLoad==>Optional("60-7624")
pShipmentDCBeforeLoad==>Optional("4505023274")
See from the picture
After login -> page 1 -> go to page 2 this code on page 2
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Check segue identifier
if segue.identifier == "gotoAfterLoadingDC" {
// Get SecondVC
let destinationVC = segue.destination as! AfterLoadViewController
// Pass text to SecondVC
destinationVC.pShipmentDCAfterLoad = pShipmentDCBeforeLoad!
destinationVC.pPlanDateDCAfterLoad = pPlanDateDCBeforeLoad!
destinationVC.TruckIdDCAfterLoad = TruckIdDCBeforeLoad!
destinationVC.ptruckNoDCAfterLoad = ptruckNoDCBeforeLoad
destinationVC.PlanDetailIdDCAfterLoad = PlanDetailIdDCBeforeLoad!
}
}
press Home button on page 2 -> go to page 1
@IBAction func BacktoPlandata(_ sender: UIBarButtonItem) {
DispatchQueue.main.async {
//self.performSegue(withIdentifier: "BeforeloadBacktoplandata", sender: "self")
func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Back to home
if segue.identifier == "BeforeloadBacktoplandata" {
//Get SecondVC
let destinationVC = segue.destination as! PlanDataViewController
//Pass text to SecondVC
destinationVC.getpShipmentPickerView.text! = self.pShipmentDCBeforeLoad!
destinationVC.getpPlanDatePickerView.text! = self.pPlanDateDCBeforeLoad!
destinationVC.ptruckidDCPlanData = self.TruckIdDCBeforeLoad!
destinationVC.ptruckNoDCPlanData = self.ptruckNoDCBeforeLoad
destinationVC.pPlandDetailIdDCPlanData = self.PlanDetailIdDCBeforeLoad!
// Show log back to plandata
print("pShipmentDCBeforeLoad==>\(String(describing: self.pShipmentDCBeforeLoad))")
print("pPlanDateDCBeforeLoad==>\(String(describing: self.pPlanDateDCBeforeLoad))")
print("TruckIdDCBeforeLoad==>\(String(describing: self.TruckIdDCBeforeLoad))")
print("ptruckNoDCBeforeLoad==>\(String(describing: self.ptruckNoDCBeforeLoad))")
print("pShipmentDCBeforeLoad==>\(String(describing: self.pShipmentDCBeforeLoad))")
// call fuction
print("//////////////-getPlanDetail-BacktoPlandata-/////////////////")
self.getPlanDetailDCbeforeLoadingViewController(pshipment: self.pShipmentDCBeforeLoad!, pplanDate: self.pPlanDateDCBeforeLoad!)
}
}
}
}