VCA push 到VCB, VCB 完全 pop 会VCA 后,想执行VCB里的代码,怎么执行
在VC B 里设置navigationController 的 delegate:
self.navigationController?.delegate = self
然后执行delegate方法:
有didShow方法和 willShow 两个方法,根据业务选一个
func navigationController(_ navigationController: UINavigationController, didShow viewController: UIViewController, animated: Bool) {
print("111",viewController)
//这里执行想要执行的方法
//这个方法.push进来也会执行,pop出去也会执行,所以要判断 viewController 是那个VC
}
func navigationController(_ navigationController: UINavigationController, willShow viewController: UIViewController, animated: Bool) {
//这里执行想要执行的方法
print("000",viewController)
}