1.代理传值()MapViewController传值
protocol MapViewDelegate : NSObjectProtocol
{
func selectedAddress(mapViewController:MapViewController,address:String?)
}
weak var delegate:MapViewDelegate?
self.delegate?.selectedAddress(mapViewController: self,address: currentAddress)
2.接收值 AddOrderViewController
mapVC.delegate =self
extension AddOrderViewController:MapViewDelegate{
func selectedAddress(mapViewController:MapViewController, address:String?) {
guardlet path = address else { return }
if mapViewController.view.tag ==1 {
self.source = path
//nOrder.sourcePlace = path
let paths = [IndexPath(row:0, section: 0)]
self.tableView.reloadRows(at: paths, with: .automatic)
}else{
self.destination = path
//nOrder.destinationPlace = path
let paths = [IndexPath(row:1, section: 0)]
self.tableView.reloadRows(at: paths, with: .automatic)
}
}
}