我有一个关于将值发送回主页的问题登录后->第1页->第2页->按主页按钮->第1页当我去的时候,交付没有问题。但我想按下主页按钮并将值返回到 page1
这在第 2 页上
pShipmentDCBeforeLoad==>Optional("4505023274")
pPlanDateDCBeforeLoad==>Optional("20190119")
TruckIdDCBeforeLoad==>Optional("2")
ptruckNoDCBeforeLoad==>Optional("60-7624")
pShipmentDCBeforeLoad==>Optional("4505023274")
从图片上看
登录后->第1页->转到第2页此代码在第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!
}
}
按第 2 页上的主页按钮 -> 转到第 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!)
}
}
}
}