我收到 Json 响应,parentviewcontroller
我想将该响应中的数组值传递给childviewcontroller
.
问问题
60 次
1 回答
0
试试这个方法
class parentVC: UIViewController {
...
let childController = UIStoryboard(name: "Storyboard-Name", bundle: nil).instantiateViewController(withIdentifier: "Child Viewcontroller Id") as? ChildVC
childController.arrayFromParent = arrayToPass //You can pass value to a variable in child viewcontroller.
}
class ChildVC: UIViewController {
var arrayFromParent = [String]()
...
}
于 2018-01-04T07:29:54.413 回答