我有这个代码但是,我没有收到第二个视图控制器中的数据......我在这里做错了什么?
let storyboard = UIStoryboard(name: "PostSubmit", bundle: nil)
let vc = storyboard.instantiateViewController(withIdentifier: "PostSubmitVC") as! PostSubmitViewController {
let nc = UINavigationController(rootViewController: vc)
vc.filteredResult = filteredResult
}
self.present(nc, animated: false, completion: nil)
答案 0 :(得分:1)
可能问题是你提出的错误的控制器nc
值是否在块内部,并且它不在块的旁边。
let vc = storyboard.instantiateViewController(withIdentifier: "PostSubmitVC") as! PostSubmitViewController
let nc = UINavigationController(rootViewController: vc)
vc.filteredResult = filteredResult
self.present(nc, animated: false, completion: nil)