我在LocationVC ViewController上有一个变量“ NameofCircle”,并且在此Controller上有变量CName,我想通过popToViewController将CName值传递给LocationVC Controller。我尝试了下面的代码,但没有得到结果。
let viewControllers = self.navigationController!.viewControllers
for aViewController in viewControllers
{
if aViewController is LocationVC
{
let Location = LocationVC()
Location.NameofCircle = CName
_ = self.navigationController?.popToViewController(aViewController, animated: true)
}
}
Run Code Online (Sandbox Code Playgroud)