在返回值页面:
声明:
typealias getTitleAndID = (String,String) -> Void
var biBao:(getTitleAndID)!
跳页返回时候
self.biBao(self.needTitle!,self.needID!)
self.popVC()
接受返回值的页面:(其实也是点击跳页的方法中)
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if indexPath.row == 2 {
let SB = UIStoryboard.init(name: "Main", bundle: Bundle.main)
let VC = SB.instantiateViewController(withIdentifier: "AddressDetailVC") as! AddressDetailVC
VC.biBao = {(title,ID) in
print(title,"--------------",ID)
self.needTitle = title
self.needID = ID
self.tableView.reloadRows(at: [indexPath], with: .none)
}
self.navigationController?.pushViewController(VC, animated: true)
}
}
网友评论