【发布时间】:2019-12-08 12:54:31
【问题描述】:
我有一个关于将值发送回主页的问题 登录后->第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!)
}
}
}
}
【问题讨论】: